Use Emacs for remote compilation and catch output

June 2013 · 1 minute read

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 build_remote.sh script with following contents

#!/bin/bash
ssh my_remote_machine "source my_environment_file; cd my_build_directory; make 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)

Share: 
Buy me a coffeeBuy me a coffee
comments powered by Disqus