Ubuntu: Unable to compile, missing GLX_mesa

I got some odd issue. I had to reinstall some desktop stuff on my Ubuntu machine and since then openFrameworks ~0.10.0 does not want to compile anymore because GLX_mesa is missing. I’m fairly certain that all Mesa stuff is installed but maybe I’m missing something. I was unable to locate the necessary package to install this library. Maybe someone here knows more?
I doubt it has anything to do with changes made in 0.10.0 though.

E: it seems the library comes from libglx-mesa0 which is installed. I tried to purge it and reinstall it but still the same issue.

of_v20180420_linux64gcc6_release/libs/tess2/lib/l
inux64/libtess2.a -lz -lgstapp-1.0 -lgstvideo-1.0
-lgstbase-1.0 -lgstreamer-1.0 -ludev -lfontconfig -l
freetype -lsndfile -lopenal -lcurl -lglfw -lrtaudio
-lpulse-simple -lpulse -lasound -lGLEW -lGLU -lGLX_m
esa -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -la
tk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgi
o-2.0 -lgobject-2.0 -lglib-2.0 -lmpg123 -lavformat -
lavcodec -lavutil -lswresample -lglut -lX11 -lXrandr
-lXxf86vm -lXi -lXcursor -ldl -lpthread -lfreeimage
-lboost_filesystem -lboost_system -lpugixml -luripa
rser -lXinerama
/usr/bin/x86_64-linux-gnu-ld: cannot find -lGLX_mesa

Hey @Prof_Sparkles, i ran into a similar issue recently on my ubuntu install (18.04) - and it seems that a missing link was the reason it failed on my system.

Here is how I tracked down the issue:

  1. Check that GLX_mesa is indeed available on the system:
    (note that I had to install apt-file first for this)
apt-file search GLX_mesa

The output I got was:

libglx-mesa0: /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
libglx-mesa0: /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0.0.0

That means that GLX_mesa is indeed installed (that’s no surprise, as it’s a default library)

  1. Then I checked on what the linker reported, to see what the error may be:
ld -lGLX_mesa --verbose

The output here was:
==================================================
attempt to open //usr/local/lib/x86_64-linux-gnu/libGLX_mesa.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libGLX_mesa.a failed
attempt to open //lib/x86_64-linux-gnu/libGLX_mesa.so failed
attempt to open //lib/x86_64-linux-gnu/libGLX_mesa.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libGLX_mesa.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libGLX_mesa.a failed
attempt to open //usr/lib/x86_64-linux-gnu64/libGLX_mesa.so failed
attempt to open //usr/lib/x86_64-linux-gnu64/libGLX_mesa.a failed
attempt to open //usr/local/lib64/libGLX_mesa.so failed
attempt to open //usr/local/lib64/libGLX_mesa.a failed
attempt to open //lib64/libGLX_mesa.so failed
attempt to open //lib64/libGLX_mesa.a failed
attempt to open //usr/lib64/libGLX_mesa.so failed
attempt to open //usr/lib64/libGLX_mesa.a failed
attempt to open //usr/local/lib/libGLX_mesa.so failed
attempt to open //usr/local/lib/libGLX_mesa.a failed
attempt to open //lib/libGLX_mesa.so failed
attempt to open //lib/libGLX_mesa.a failed
attempt to open //usr/lib/libGLX_mesa.so failed
attempt to open //usr/lib/libGLX_mesa.a failed
attempt to open //usr/x86_64-linux-gnu/lib64/libGLX_mesa.so failed
attempt to open //usr/x86_64-linux-gnu/lib64/libGLX_mesa.a failed
attempt to open //usr/x86_64-linux-gnu/lib/libGLX_mesa.so failed
attempt to open //usr/x86_64-linux-gnu/lib/libGLX_mesa.a failed
ld: cannot find -lGLX_mesa

Which means that indeed, it can’t find lib_GLX_mesa.so, and that it seems to look quite literally for a file named libGLX_mesa.so, but ours has a version number attached.

But then we know from 1.) where the library lives on our system. I’m assuming therefore, that adding a symlink to the library we found earlier will solve the issue. We name the symlink like the library, but without a version number suffix. (that’s libGLX_mesa.so [= symlink name] -> libGLX_mesa.so.0[ =actual library])

And here is what fixed it for me:

  1. SOLUTION: Create a symlink:
sudo ln -s /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0 /usr/lib/x86_64-linux-gnu/libGLX_mesa.so

That did it for me. No more linker trouble. I’m not sure if that’s a 100% clean solution, and Ubuntu wizards will probably be able to enlighten us whether this might need some more love in the future, but for now, it seems to work…

2 Likes

I ended up reinstalling but thanks a lot for posting your fix and approach, I had similar issues in the past this will greatly help in the future :slight_smile: