Using patchelf to change the SONAME of libGLdispatch.so breaks its functionality

140 Views Asked by At

I am currently working on a python project that uses OpenGL internally. I built a wheel that works fine, and then used auditwheel to be able to deploy it. However, the auditwheel step seems to have broken OpenGL's functionality and my program crashes with a segfault as glGetString(GL_VERSION) returns 0.

I reproduced all of the steps that auditwheel does manually:

  • Copying libOpenGL.so and its dependent libGLdispatch.so to the wheel
  • Renaming libOpenGL.so and libGLdispatch.so to libOpenGL-<somespecialhash>.so and libGLdispatch-<somespecialhash>.so
  • Using patchelf to make sure my program points to the right new version of libOpenGL and that libOpenGL points to the renamed version of libGLdispatch. I used patchelf --replace-needed and patchelf --set-rpath for that. (At this point, the program works fine and ldd seems to indicate that it properly uses the new local renamed libraries.)
  • Using patchelf to change the SONAMEs of libOpenGL and libGLdispatch to match their new names

Everything works fine until the very last step, when changing the SONAME of libGLdispatch to libGLdispatch-<somespecialhash>.so. I am not very experienced in Linux's library structure so I am not sure why this last step of changing the SONAMEs breaks libGLdispatch, especially since the library can be found properly (the error I get is glGetString(GL_VERSION) returning 0, NOT "cannot open shared object file"). I am also very unsure about what is the use of that last step since it seems to be working fine without it.

Any idea what could be happening? I tried going through the source code of the libraries but didn't find any specific mention of SONAME, dlopen or dlinfo that seemed to be at fault.

Also, since everything seems to work as intended without the SONAME step, what would I actually be missing by not doing it?

Thanks a lot in advance for the help and have a good day

0

There are 0 best solutions below