-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double library references after auditwheel repair #60
Comments
Indeed this looks like a bug in auditwheel cc @rmcgibbo / @njsmith. Can you please include the output of the |
Bah, it seems I somehow managed to lose both the Docker image I was manually doing this in, and my notes on what I did (could be on my laptop at home). But I'll do it all again as soon as possible and provide you with the output. |
Alright, I found my notes again and did the test again. You can test on your side with FROM quay.io/pypa/manylinux1_x86_64
RUN yum install -y zlib-devel
# Download and extract HDF5
WORKDIR /
RUN wget http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0/src/hdf5-1.10.0.tar.bz2
RUN tar xvfj hdf5-1.10.0.tar.bz2
# Build and install HDF5
WORKDIR /hdf5-1.10.0
RUN ./configure --prefix=/hdf5 --enable-unsupported --enable-threadsafe
RUN make
RUN make install
# Download and extract h5py master
WORKDIR /
RUN curl -L -o master.zip https://github.com/h5py/h5py/archive/master.zip
RUN unzip master.zip
# Compile h5py wheel
WORKDIR /h5py-master
ENV HDF5_DIR=/hdf5
RUN /opt/python/cp34-cp34m/bin/pip wheel . -w wheelhouse/
# Look at the wheel
RUN auditwheel show wheelhouse/h5py-2.6.0-cp34-cp34m-linux_x86_64.whl
# Build manylinux wheel
RUN auditwheel repair wheelhouse/h5py-2.6.0-cp34-cp34m-linux_x86_64.whl -w wheelhouse/
# Look at the wheelhouse
RUN ls -l wheelhouse/
# Install manylinux wheel
RUN /opt/python/cp34-cp34m/bin/pip install h5py --no-index -f wheelhouse/
# Look at library references of installed h5a.cpython-34m.so
RUN ldd /opt/_internal/cpython-3.4.4/lib/python3.4/site-packages/h5py/h5a.cpython-34m.so The relevant output from
The output looks okay to me, but I'm not sure what to look for . |
Or, looking closer, the problem is that RPATH is not set on libhdf5-18711fcd.so.100.0.0, which also has a dependency on libz:
This is what led to libz-a147dcb0.so.1.2.3 showing up twice in the ldd output for h5a.cpython-34m.so above. Any idea what might be special about libhdf5-18711fcd.so.100.0.0 which makes the RPATH fixup miss it? |
I realize now that this may not be an
Unlike libhdf5_hl.so.100.0.0, it seems libhdf5.so.100.0.0 has no RPATH set to begin with :/ |
And confirmed also with
So I guess I'll have to figure out why HDF5 sets RPATH on one of them but not the other. |
I think this is just because zlib on the other hand is installed in the standard |
Could you please include the output of readelf on |
Alright, but correct me if I'm wrong: The tool requires the library to have an RPATH to begin with in order to work? It can't add an RPATH from scratch? If so I think I must look into the build of HDF5, since at the moment it produces Here's the output of
|
Or wait, now I think I see what you mean. So perhaps my problem could be worked around by install HDF5 to prefix /usr? I'll give it a try. |
Okay, installing HDF5 to prefix
The repair command is now:
And the result is that:
Not quite sure where to go from here :/ |
No, it shouldn't matter whether a library already has an RPATH or not -- we should always be setting a RPATH. (Or really we should always be setting a RUNPATH, which is basically the same.) Maybe this has something to do with auditwheel treating transitive dependencies differently from direct dependencies or .so files that are included in the library directly? Really I think we should just be copying in all transitive dependencies, and then setting RUNPATH on everything in the new wheel -- no point in trying to be clever about which things need RUNPATH and which don't. |
Alright, I see. The logic in https://github.com/pypa/auditwheel/blob/master/auditwheel/repair.py#L129 and then https://github.com/pypa/auditwheel/blob/master/auditwheel/repair.py#L135-L139 I thought you could only modify an existing RPATH, not insert one, but it seems |
If the library that's being grafted in doesn't contain an existing RPATH or RUNPATH, I don't think it needs to acquire one... |
@rmcgibbo: Ah that makes sense, wasn't thinking straight yesterday. But, do you have any idea why I end up with:
This was from my last test, from when HDF5 was installed to /usr and consequently none of its two libraries had RPATH set to begin with. In the above situation, libz-a147dcb0.so.1.2.3 should be found right? |
I just have to ask:
If the wheel has a transient dependency on a library though, shouldn't RPATH then be set on the intermediate library, so that it can find its dependency in turn? |
To clarify (sorry for the bad asciii art, on my phone now), I think I have the following situation:
Shouldn't libhdf5 and libhdf5_hl be given rpaths here for this to work, despite not having any to begin with, for their dependencies to be found? |
That turned out horrible:
|
Okay, I think I see the bug and how to fix it. |
Great, I had a look at your fix. Did you test it with the above yet? I'm on the bus but can test in half an hour or so. But looking at the change, isn't it still the case that it will only set rpath if there already is one? If so, I'm not sure it'll work still... But will test. |
Yea, I tested it on the h5py build and got it to import successfully after repair. Sent from my iPhone
|
Ah, excellent, then it's just me misunderstanding. Many thanks! |
Can you test to see if auditwheel 1.10.0rc1 fixes this? |
Hi, I think I've hit the same issue with current ==============
WHEEL ANALYSIS
==============
Analysing /io/dist/pygit2-0.27.4-cp27-cp27m-manylinux1_x86_64.whl...
pygit2-0.27.4-cp27-cp27m-manylinux1_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".
The wheel references external versioned symbols in these system-
provided shared libraries: libc.so.6 with versions {'GLIBC_2.3',
'GLIBC_2.2.5', 'GLIBC_2.3.4', 'GLIBC_2.3.2', 'GLIBC_2.4'}, librt.so.1
with versions {'GLIBC_2.2.5'}, libdl.so.2 with versions
{'GLIBC_2.2.5'}, libpthread.so.0 with versions {'GLIBC_2.2.5',
'GLIBC_2.3.2'}
The following external shared libraries are required by the wheel:
{
"libc.so.6": "/lib64/libc-2.5.so",
"libcurl.so.4": "/usr/local/lib/libcurl.so.4.5.0",
"libdl.so.2": "/lib64/libdl-2.5.so",
"libpthread.so.0": "/lib64/libpthread-2.5.so",
"librt.so.1": "/lib64/librt-2.5.so",
"libssh2.so.1": "/usr/local/lib64/libssh2.so.1.0.1",
"libz.so.1": "/lib64/libz.so.1.2.3"
}
In order to achieve the tag platform tag "manylinux2010_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
Unpacking to: /tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27m-pygit2/pygit2-0.27.4
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27m-pygit2/pygit2-0.27.4/pygit2/.libs/libcurl-e8503455.so.4.5.0'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27m-pygit2/pygit2-0.27.4/pygit2/.libs/libgit2-e2c814dd.so.0.27.8'
libcurl-e8503455.so.4.5.0 => not found
libz-a147dcb0.so.1.2.3 => not found
libssh2-1766d285.so.1.0.1 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27m-pygit2/pygit2-0.27.4/pygit2/.libs/libssh2-1766d285.so.1.0.1'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27m-pygit2/pygit2-0.27.4/pygit2/.libs/libz-a147dcb0.so.1.2.3'
Analysing /io/dist/pygit2-0.27.4-cp27-cp27mu-manylinux1_x86_64.whl...
pygit2-0.27.4-cp27-cp27mu-manylinux1_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".
The wheel references external versioned symbols in these system-
provided shared libraries: libc.so.6 with versions {'GLIBC_2.3.2',
'GLIBC_2.3', 'GLIBC_2.3.4', 'GLIBC_2.2.5', 'GLIBC_2.4'}, librt.so.1
with versions {'GLIBC_2.2.5'}, libpthread.so.0 with versions
{'GLIBC_2.3.2', 'GLIBC_2.2.5'}, libdl.so.2 with versions
{'GLIBC_2.2.5'}
The following external shared libraries are required by the wheel:
{
"libc.so.6": "/lib64/libc-2.5.so",
"libcurl.so.4": "/usr/local/lib/libcurl.so.4.5.0",
"libdl.so.2": "/lib64/libdl-2.5.so",
"libpthread.so.0": "/lib64/libpthread-2.5.so",
"librt.so.1": "/lib64/librt-2.5.so",
"libssh2.so.1": "/usr/local/lib64/libssh2.so.1.0.1",
"libz.so.1": "/lib64/libz.so.1.2.3"
}
In order to achieve the tag platform tag "manylinux2010_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
Unpacking to: /tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27mu-pygit2/pygit2-0.27.4
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27mu-pygit2/pygit2-0.27.4/pygit2/.libs/libcurl-e8503455.so.4.5.0'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27mu-pygit2/pygit2-0.27.4/pygit2/.libs/libgit2-e2c814dd.so.0.27.8'
libcurl-e8503455.so.4.5.0 => not found
libz-a147dcb0.so.1.2.3 => not found
libssh2-1766d285.so.1.0.1 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27mu-pygit2/pygit2-0.27.4/pygit2/.libs/libssh2-1766d285.so.1.0.1'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp27-cp27mu-pygit2/pygit2-0.27.4/pygit2/.libs/libz-a147dcb0.so.1.2.3'
Analysing /io/dist/pygit2-0.27.4-cp34-cp34m-manylinux1_x86_64.whl...
pygit2-0.27.4-cp34-cp34m-manylinux1_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".
The wheel references external versioned symbols in these system-
provided shared libraries: libc.so.6 with versions {'GLIBC_2.3.4',
'GLIBC_2.4', 'GLIBC_2.2.5', 'GLIBC_2.3', 'GLIBC_2.3.2'}, librt.so.1
with versions {'GLIBC_2.2.5'}, libdl.so.2 with versions
{'GLIBC_2.2.5'}, libpthread.so.0 with versions {'GLIBC_2.3.2',
'GLIBC_2.2.5'}
The following external shared libraries are required by the wheel:
{
"libc.so.6": "/lib64/libc-2.5.so",
"libcurl.so.4": "/usr/local/lib/libcurl.so.4.5.0",
"libdl.so.2": "/lib64/libdl-2.5.so",
"libpthread.so.0": "/lib64/libpthread-2.5.so",
"librt.so.1": "/lib64/librt-2.5.so",
"libssh2.so.1": "/usr/local/lib64/libssh2.so.1.0.1",
"libz.so.1": "/lib64/libz.so.1.2.3"
}
In order to achieve the tag platform tag "manylinux2010_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
Unpacking to: /tmp/pygit2-manylinux1-build.dHVbt28669/cp34-cp34m-pygit2/pygit2-0.27.4
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp34-cp34m-pygit2/pygit2-0.27.4/pygit2/.libs/libcurl-e8503455.so.4.5.0'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp34-cp34m-pygit2/pygit2-0.27.4/pygit2/.libs/libgit2-e2c814dd.so.0.27.8'
libcurl-e8503455.so.4.5.0 => not found
libz-a147dcb0.so.1.2.3 => not found
libssh2-1766d285.so.1.0.1 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp34-cp34m-pygit2/pygit2-0.27.4/pygit2/.libs/libssh2-1766d285.so.1.0.1'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp34-cp34m-pygit2/pygit2-0.27.4/pygit2/.libs/libz-a147dcb0.so.1.2.3'
Analysing /io/dist/pygit2-0.27.4-cp35-cp35m-manylinux1_x86_64.whl...
pygit2-0.27.4-cp35-cp35m-manylinux1_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".
The wheel references external versioned symbols in these system-
provided shared libraries: libc.so.6 with versions {'GLIBC_2.4',
'GLIBC_2.3.4', 'GLIBC_2.3', 'GLIBC_2.3.2', 'GLIBC_2.2.5'}, librt.so.1
with versions {'GLIBC_2.2.5'}, libpthread.so.0 with versions
{'GLIBC_2.2.5', 'GLIBC_2.3.2'}, libdl.so.2 with versions
{'GLIBC_2.2.5'}
The following external shared libraries are required by the wheel:
{
"libc.so.6": "/lib64/libc-2.5.so",
"libcurl.so.4": "/usr/local/lib/libcurl.so.4.5.0",
"libdl.so.2": "/lib64/libdl-2.5.so",
"libpthread.so.0": "/lib64/libpthread-2.5.so",
"librt.so.1": "/lib64/librt-2.5.so",
"libssh2.so.1": "/usr/local/lib64/libssh2.so.1.0.1",
"libz.so.1": "/lib64/libz.so.1.2.3"
}
In order to achieve the tag platform tag "manylinux2010_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
Unpacking to: /tmp/pygit2-manylinux1-build.dHVbt28669/cp35-cp35m-pygit2/pygit2-0.27.4
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp35-cp35m-pygit2/pygit2-0.27.4/pygit2/.libs/libcurl-e8503455.so.4.5.0'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp35-cp35m-pygit2/pygit2-0.27.4/pygit2/.libs/libgit2-e2c814dd.so.0.27.8'
libcurl-e8503455.so.4.5.0 => not found
libz-a147dcb0.so.1.2.3 => not found
libssh2-1766d285.so.1.0.1 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp35-cp35m-pygit2/pygit2-0.27.4/pygit2/.libs/libssh2-1766d285.so.1.0.1'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp35-cp35m-pygit2/pygit2-0.27.4/pygit2/.libs/libz-a147dcb0.so.1.2.3'
Analysing /io/dist/pygit2-0.27.4-cp36-cp36m-manylinux1_x86_64.whl...
pygit2-0.27.4-cp36-cp36m-manylinux1_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".
The wheel references external versioned symbols in these system-
provided shared libraries: libc.so.6 with versions {'GLIBC_2.2.5',
'GLIBC_2.3.4', 'GLIBC_2.3.2', 'GLIBC_2.3', 'GLIBC_2.4'}, librt.so.1
with versions {'GLIBC_2.2.5'}, libdl.so.2 with versions
{'GLIBC_2.2.5'}, libpthread.so.0 with versions {'GLIBC_2.3.2',
'GLIBC_2.2.5'}
The following external shared libraries are required by the wheel:
{
"libc.so.6": "/lib64/libc-2.5.so",
"libcurl.so.4": "/usr/local/lib/libcurl.so.4.5.0",
"libdl.so.2": "/lib64/libdl-2.5.so",
"libpthread.so.0": "/lib64/libpthread-2.5.so",
"librt.so.1": "/lib64/librt-2.5.so",
"libssh2.so.1": "/usr/local/lib64/libssh2.so.1.0.1",
"libz.so.1": "/lib64/libz.so.1.2.3"
}
In order to achieve the tag platform tag "manylinux2010_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
Unpacking to: /tmp/pygit2-manylinux1-build.dHVbt28669/cp36-cp36m-pygit2/pygit2-0.27.4
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp36-cp36m-pygit2/pygit2-0.27.4/pygit2/.libs/libcurl-e8503455.so.4.5.0'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp36-cp36m-pygit2/pygit2-0.27.4/pygit2/.libs/libgit2-e2c814dd.so.0.27.8'
libcurl-e8503455.so.4.5.0 => not found
libz-a147dcb0.so.1.2.3 => not found
libssh2-1766d285.so.1.0.1 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp36-cp36m-pygit2/pygit2-0.27.4/pygit2/.libs/libssh2-1766d285.so.1.0.1'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp36-cp36m-pygit2/pygit2-0.27.4/pygit2/.libs/libz-a147dcb0.so.1.2.3'
Analysing /io/dist/pygit2-0.27.4-cp37-cp37m-manylinux1_x86_64.whl...
pygit2-0.27.4-cp37-cp37m-manylinux1_x86_64.whl is consistent with the
following platform tag: "linux_x86_64".
The wheel references external versioned symbols in these system-
provided shared libraries: libc.so.6 with versions {'GLIBC_2.2.5',
'GLIBC_2.3', 'GLIBC_2.4', 'GLIBC_2.3.2', 'GLIBC_2.3.4'}, librt.so.1
with versions {'GLIBC_2.2.5'}, libdl.so.2 with versions
{'GLIBC_2.2.5'}, libpthread.so.0 with versions {'GLIBC_2.3.2',
'GLIBC_2.2.5'}
The following external shared libraries are required by the wheel:
{
"libc.so.6": "/lib64/libc-2.5.so",
"libcurl.so.4": "/usr/local/lib/libcurl.so.4.5.0",
"libdl.so.2": "/lib64/libdl-2.5.so",
"libpthread.so.0": "/lib64/libpthread-2.5.so",
"librt.so.1": "/lib64/librt-2.5.so",
"libssh2.so.1": "/usr/local/lib64/libssh2.so.1.0.1",
"libz.so.1": "/lib64/libz.so.1.2.3"
}
In order to achieve the tag platform tag "manylinux2010_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
In order to achieve the tag platform tag "manylinux1_x86_64" the
following shared library dependencies will need to be eliminated:
libcurl.so.4, libssh2.so.1, libz.so.1
Unpacking to: /tmp/pygit2-manylinux1-build.dHVbt28669/cp37-cp37m-pygit2/pygit2-0.27.4
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp37-cp37m-pygit2/pygit2-0.27.4/pygit2/.libs/libcurl-e8503455.so.4.5.0'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp37-cp37m-pygit2/pygit2-0.27.4/pygit2/.libs/libgit2-e2c814dd.so.0.27.8'
libcurl-e8503455.so.4.5.0 => not found
libz-a147dcb0.so.1.2.3 => not found
libssh2-1766d285.so.1.0.1 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp37-cp37m-pygit2/pygit2-0.27.4/pygit2/.libs/libssh2-1766d285.so.1.0.1'
libz-a147dcb0.so.1.2.3 => not found
ldd: warning: you do not have execution permission for `/tmp/pygit2-manylinux1-build.dHVbt28669/cp37-cp37m-pygit2/pygit2-0.27.4/pygit2/.libs/libz-a147dcb0.so.1.2.3' Backref: libgit2/pygit2#793 (comment) Reproducer$ git clone git://github.com/libgit2/pygit2.git
$ cd pygit2
$ travis/build-all-manylinux1-wheels.sh pygit2 0.27
# or
$ docker run --network host --rm -v `pwd`:/io -it pyca/cryptography-manylinux1:x86_64 /io/travis/build-manylinux1-wheels.sh pygit2 0.27 |
@webknjaz the issue you're reporting above looks unrelated to this bug, there appears to be something wonky happening with your wheel build such that the RPATHs are still pointed at system locations and ldd can't process it properly. I can try reproducing but I'm not sure this is this issue reported above (which was reported nearly three years ago and I think was fixed in the aforementioned release of auditwheel). |
@ehashman probably you're right. Anyway, I've fixed things by compiling deps statically. |
Sorry if this is obvious, but I tried for fun to manually create an anylinux wheel for h5py from a shell inside the provided x64 Docker container. However, it seems the rpath fixup didn't go too well for libz:
After the fixed up wheel was installed:
Notice the two references to
libz-a147dcb0.so.1.2.3
, one of them found, the other one not. Any idea what could have gone wrong, or how I can debug further? The bundling of libhdf5 seems to have worked fine.The text was updated successfully, but these errors were encountered: