0

I compiled Emacs to run on Redhat Linux. Since I wanted to compile it with --with-native-compilation flag, I had to install Redhat's developer tools to get libgccjit. These tools are installed in /opt/rh/devtoolset-10/root. An enable script is provided which modifies the LD_LIBRARY_PATH and PKG_CONFIG_PATH.

I ran configure like:

./configure --with-x --with-native-compilation --with-json --with-imagemagick

After running make and install, I noticed that I was unable to launch emacs from the Applications menu (it would fail silently), and that I was only able to launch emacs from a terminal if I first ran the devtool-10 enable script. If I don't run the script first, I receive the error:

emacs: error while loading shared libraries: libgccjit.so.0: cannot open shared object file: No such file or directory

I do not do a lot C or C++ programming, and don't have much experience compiling software, except when doing something like this. Are there flags or directives I can set on the configure script, somewhere, that would fix the location of the the dynamically linked files so that it doesn't depend on LD_LIBRARY_PATH being set when running the application?

Jacob Lee
  • 425
  • 1
  • 7
  • 12
  • 2
    You can set rpath/runpath in that binary: https://stackoverflow.com/questions/13769141/can-i-change-rpath-in-an-already-compiled-binary (acts as a permanent replacement for setting LD_LIBRARY_PATH) –  Jul 15 '21 at 20:24
  • Thank you for the suggestion. I learned something new, and it worked. When I use chrpath on my compiled emacs binary, it says that `no rpath or runpath tag found`. So I installed patchelf, and was able to set the rpath, and it worked. I'm going to leave question up, however, because I'm interested in whether there is a typical flag to set or option used in configure to do the same thing at compile or install time. – Jacob Lee Jul 15 '21 at 21:10
  • Update: setting rpath allowed me to launch Emacs, but then emacs gave lots of libgccjit.so errors afterword, when trying to lazy compile different internal applications: error invoking gcc driver. Sigh. – Jacob Lee Jul 15 '21 at 21:21

0 Answers0