Building manylinux wheel ; problem after using auditwheel

Hi,

I’m trying to build a binary extension. At the origin, I have a C++ code using BLAS, LAPACK, and OpenGL.

I made bindings thanks to PyBind11, and I build a wheel with scikit-build. This work well on my linux, on a MacOS, before and after delocate.
Now I try to build a manylinux wheel, using pypa manylinux 2014 docker image or the dockcross one. The first created wheel works well on my computer, but the wheel treated by auditwheel give me a SIGSEGV.

This is part of the backtrace I obtain with gdb -ex r --args python -c “import multitracker” (the name of the package is multitracker)

#0  0x0000000000000000 in ?? ()
#1  0x00007ffff443efd2 in __glDispatchInit () from /home/perez/Documents/multitracker/.venv2/lib/python3.10/site-packages/multitracker/../multitracker.libs/libGLdispatch-dcc1ca97.so.0.0.0
#2  0x00007ffff5eee0cc in __glXInit () at ../libglvnd-v1.6.0/src/GLX/libglx.c:2079
#3  0x00007ffff7fcdcee in call_init (env=0x7fffffffd838, argv=0x7fffffffd818, argc=3, l=) at dl-init.c:70

If I inspect the .so inside the manylinux wheel with ldd, In find duplicated entries:

libGLdispatch-dcc1ca97.so.0.0.0 => ../multitracker.libs/libGLdispatch-dcc1ca97.so.0.0.0 
libGLdispatch.so.0 => /usr/lib/libGLdispatch.so.0

libGLX-404aa684.so.0.0.0 => ../multitracker.libs/libGLX-404aa684.so.0.0.0 
libGLX.so.0 => /usr/lib/libGLX.so.0

I’m not an expert at all in compilation, but I do find it weird. Furthermore, if I import my package with LD_PRELOAD=(path to one of the two libGLdispatch), it works on my computer, no SIGSEGV anymore.

Do you know what could be the problem ?

In the manylinux docker image, I yum install freeglut-devel blas-devel lapack-devel and it suits CMake, but do I need to compile everything locally in order to produce a manylinux wheel ?

I add that I can also “solve” the problem by adding --exclude libGLdispatch.so.0 to the arguments of auditwheel.

This is not 100% satisfying as it remains for end users to also have this library, if I understand correctly ; and this is not guaranteed.

I am not an expert here, but I’d encourage you to use cibuildwheel, which automates much of this work, and works with scikit-build.