Eric C.
Eric C.

Reputation: 376

Auditwheel ELF alignment error on shared library

I have a Cython project that is pulling in FFTW. When I build my project with

python setup.py build_ext --inplace

and then import the generated .so from python it runs just fine. But when I try to build a wheel with

auditwheel repair --plat manylinux2014_x86_64 dist/<package>.whl -w wheelhouse/

and upload the resultant .whl in wheelhouse/ to our hosted pypi the resulting wheel doesn't work after installation. When I try to import it I get the error that:

ImportError: libfftw3-<sha>.so.3.3.2: ELF load command address/offset not properly aligned

Inspecting the whl it is neat that auditwheel seems to copy the FFTW .so library into it (I believe a stripped version). That would be great, if it worked.

Note that this is on the same machine, it's just the difference between using the built .so versus creating the .whl and uploading it and then pip installing it.

Am I doing something wrong? Are there options on auditwheel I should be using?

Upvotes: 0

Views: 121

Answers (1)

Eric C.
Eric C.

Reputation: 376

It's embarassing the answer was this simple, but it seems like if I add --strip to the auditwheel command it works fine:

auditwheel repair --strip --plat manylinux2014_x86_64 dist/<package>.whl -w wheelhouse/

Alternatively, I also found that I could exclude the fftw library from the auditwheel package and just rely on the system package manager having it installed. I don't like that as much because I don't know how to enforce an external dependency like that for a python package.

auditwheel repair --exclude libfftw3.so.3 --plat manylinux2014_x86_64 dist/<package>.whl -w wheelhouse/

It was a bit of a pain to find the right exclude parameter, I had to use objdump on the .so to see it had the major version number on it.

Upvotes: 0

Related Questions