Inconsistency error with libGL.so

Problem

I compiled and linked an OpenGL program with -lGL. On executing the program, I got this runtime error:

Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed!

Solution

The cryptic error message held some clues. I guessed there was some inconsistency between the various shared library files being linked into the program.

Searching for the OpenGL library gave multiple results:

$ locate libGL.so
/usr/lib/nvidia-331/libGL.so
/usr/lib/nvidia-331/libGL.so.1
/usr/lib/nvidia-331/libGL.so.331.38
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/x86_64-linux-gnu/mesa/libGL.so
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
/usr/lib32/nvidia-331/libGL.so
/usr/lib32/nvidia-331/libGL.so.1
/usr/lib32/nvidia-331/libGL.so.331.38

There seemed to be two versions of the library file: one from MESA located in the standard library directory and another from NVIDIA located in its own directory. I guessed that the MESA file must be getting linked and at runtime it could not work with the NVIDIA display driver. A bit of Googling ended up in this bug report which painted a similar picture.

This bug was not yet fixed for my Ubuntu system. So, explicitly using the NVIDIA library file for linking, using -L/usr/lib/nvidia-331 acted as a workaround for this error. The program compiled and executed without any errors.

Tried with: NVIDIA drivers 331, Ubuntu 14.04 and NVIDIA GeForce 9600 GT

Advertisements

2 thoughts on “Inconsistency error with libGL.so”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s