Code Jamming Everyday IT problems, solutions and discussions

Use Emacs for remote compilation and catch output

Just a small tip. I have souced and makefile on remote  machine and I’m trying to compile it on my local machine, but I don’t have the compiler and environment. So when I run “M-x compile”, I use a script with following contents

#!<span style="color:#003366;">/bin/bash</span>
<span style="color:#003366;">ssh</span> my_remote_machine "<span style="color:#003366;">source</span> my_environment_file; <span style="color:#003366;">cd</span> my_build_directory; <span style="color:#003366;">make</span> my_target"

Remember, that ssh command are executed not in your common environment, so you have to import it before execution of main commands (I use source command with some script to configure environment)

Then Emacs *compilation* buffer would receive stdout from remote make and you even would be able to navigate through compiler errors in your local code (if you have correct paths)

Buy me a coffeeBuy me a coffee
comments powered by Disqus