Skip to content

missing RPATH in secondary SO packed into the wheel #451

Open
@mattip

Description

@mattip

Maybe related to #363 and others.

I may have something similar in a wheel build of OpenBLAS. It packages a OpenBLAS shared object, which depends on libgfortran, which depends on libquadmath. Both of the support so's are packed by auditwheel into the wheel, but the RPATH in libgfortran is not set to $ORIGIN, so libquadmath is not found. I uploaded the auditwheel-repaired wheel to testpypi so the issue can be reproduced:

$ python3.11 -m venv /tmp/test
$ source /tmp/test/bin/activate
$ pip install -i https://test.pypi.org/simple/ scipy-openblas32==0.3.23.293

# This works, `libopenblas_python` can find its dependencies:
$ python -m scipy_openblas32
OpenBLAS using 'b'OpenBLAS 0.3.23.dev DYNAMIC_ARCH NO_AFFINITY Zen MAX_THREADS=64''

# But ldd shows a problem when looking at libgfortran, note the "not found"
$ ldd /tmp/test/lib/python3.11/site-packages/scipy_openblas32/lib/libopenblas_python.so 
	linux-vdso.so.1 (0x00007ffd9fa9e000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff314c90000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff314c8b000)
	libgfortran-040039e1.so.5.0.0 => /tmp/test/lib/python3.11/site-packages/scipy_openblas32/lib/./libgfortran-040039e1.so.5.0.0 (0x00007ff314600000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff3143d8000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff316e3d000)
	libquadmath-96973f99.so.0.0.0 => /tmp/test/lib/python3.11/site-packages/scipy_openblas32/lib/./libquadmath-96973f99.so.0.0.0 (0x00007ff314000000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff314c6d000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff314c4d000)
$ ldd /tmp/test/lib/python3.11/site-packages/scipy_openblas32/lib/libgfortran-040039e1.so.5.0.0 
	linux-vdso.so.1 (0x00007fff45797000)
	libquadmath-96973f99.so.0.0.0 => not found
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f32b68e7000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f32b6319000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f32b68c7000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f32b60f1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f32b6936000)

This is only an issue when building a c-extension project (like NumPy or Scipy) that links to libopenblas_python: the linker cannot find libquadmath. Since the whole point of this package is to provide OpenBLAS for consumption by NumPy/SciPy, the failure to link is a problem.

As @rgommers points out, I can use patchelf to add an RPATH to the packaged libgfortran, but isn't this a bug in auditwheel?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions