5

I'm trying to build Emacs 26 from source but make fails

./temacs --batch  --load loadup bootstrap
./temacs: error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory

If I search for libjpeg.so I have

$ locate libjpeg.so
/home/boffi/Downloads/processing-3.3.5/java/lib/amd64/libjpeg.so
/home/boffi/lib/miniconda3/lib/libjpeg.so
/home/boffi/lib/miniconda3/lib/libjpeg.so.9
/home/boffi/lib/miniconda3/lib/libjpeg.so.9.2.0
/home/boffi/lib/miniconda3/pkgs/jpeg-9b-habf39ab_1/lib/libjpeg.so
/home/boffi/lib/miniconda3/pkgs/jpeg-9b-habf39ab_1/lib/libjpeg.so.9
/home/boffi/lib/miniconda3/pkgs/jpeg-9b-habf39ab_1/lib/libjpeg.so.9.2.0
/usr/lib/x86_64-linux-gnu/libjpeg.so
/usr/lib/x86_64-linux-gnu/libjpeg.so.62
/usr/lib/x86_64-linux-gnu/libjpeg.so.62.2.0

and it seems to me that Emacs is not looking at the system libraries...

Grepping the output of configure I have another suspicious line

$ ./configure | grep miniconda
  Does Emacs use a png library?    yes -  L/home/boffi/lib/miniconda3/lib -lpng16

My question is, how can I screen the libraries installed by the Anaconda Python Distribution for its own use, so that ./configure does not mess with them?

Or, on the other hand, how can I have temacs and later Emacs find the library they expect to load?

3
  • I had to uninstall conda to get the compile to work. Commented Jun 4, 2018 at 18:07
  • 1
    @JustinThomas Uninstalling conda is a bit too much, have a look at the answers below. It suffices to temporarily change the PATH during the execution of config...
    – gboffi
    Commented Jun 5, 2018 at 9:51
  • Deactivating conda before install is sufficient.
    – al0
    Commented Aug 18, 2018 at 13:31

3 Answers 3

2

Emacs uses the "libpng-config" tool to locate PNG include files and libraries. So yes, if you have multiple versions installed you need to adjust PATH so that the one you want to be used, is. For other libraries, it's normally "pkg-config" that is consulted, for which there is the PKG_CONFIG_PATH environment variable. If Anaconda provides a pkg-config, it probably prefers Anaconda packages, so again adjusting PATH is probably the right solution.

1
  • 1
    Ooops, in December I somehow missed your answer, but it exactly pinpoints the problem... ፨ $ libpng-config --ldflags → -L/home/boffi/lib/miniconda3/lib -lpng16 — thanks a lot
    – gboffi
    Commented Jun 5, 2018 at 9:47
3

TL;DR export PATH=/usr/bin:/bin

I had a look at config.log to see where configure mentioned the paths used by the Anaconda distribution and I found 3 references to miniconda3 — 2 were related to the PNG libraries and one to the PATH variable... of course the bin directory of the Anaconda distribution has to be prepended to PATH, hasn't it?

To be sure that was not a problem with my PATH I issued the command

$ PATH=/usr/bin:/bin ./configure 2>/dev/null | grep -qs miniconda || make
...
make[1]: Leaving directory '/home/boffi/src/emacs-26.0.90'
$

I have now a way to shade private Anaconda libraries from the scrutiny of configure, I have an instance of Emacs 26 too and eventually I have the doubt that configure had been too smart in deducing too much from my PATH.


ps I'm not going to approve my answer because it seems to me just a workaround, I'm convinced that a better solution is possible.

0

The above answers fixed the problem but in my case I couldn't have /usr/bin before my conda path. This is because I'm using a cluster and I need specific tools with versions that I install in my conda. Putting /usr/bin in front prioritize those installed by admin before my own installs. Of cource I can then prepend another folder that contains symlinks pointing to the right versions (essentially everything inside conda/bin except for libpng-config) but that's lame and a lot of work.

What I did was simply install Emacs inside conda, install ligpng15, and it solved it.

update as of 2020/03/09:

Alternatively, I also tried to locate the missing library and add it to $LD_LIBRARY_PATH.

~$ locate libjpeg
# showing the location of libjpeg. In my case it's inside my anaconda
# /home/user/app/anaconda2/lib/libjpeg.so.9
~$ export LD_LIBRARY_PATH=/home/user/app/anaconda2/lib:$LD_LIBRARY_PATH
~$ emacs 
# launches fine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.