Skip to content

stripping some manylinux generated files produces broken shared objects #119

@gotyaoi

Description

@gotyaoi

Attempting to strip some of the .so files from some manylinux generated packages will run without error messages, but the resulting file is broken. ldd claims it is "not a dynamic executable" and trying to import it from python gives "ELF load command address/offset not properly aligned".

perhaps related to #78

Here's an example with scipy/special/_ufuncs.so, though the problem affects about 21 of the 91 .so files in scipy

$ cat /etc/os-release
NAME="Amazon Linux AMI"
VERSION="2017.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.03"
PRETTY_NAME="Amazon Linux AMI 2017.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
$ uname -a
Linux ip-10-40-23-202 4.9.27-14.31.amzn1.x86_64 #1 SMP Wed May 10 01:58:40 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ strip --version
GNU strip version 2.23.52.0.1-55.65.amzn1 20130226
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

steps to reproduce:

$ virtualenv reproducer
New python executable in reproducer/bin/python2.7
Also creating executable in reproducer/bin/python
Installing setuptools, pip...done.
$ . reproducer/bin/activate
(reproducer)$ pip install -U pip setuptools
You are using pip version 6.0.8, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144
  Using cached pip-9.0.1-py2.py3-none-any.whl
Collecting setuptools from https://pypi.python.org/packages/fc/cb/748dcabb152fbc7eceaf585d052b8bc11cf028b917a7d2343cf1e0c092c3/setuptools-36.0.1-py2.py3-none-any.whl#md5=7a52500dcfd7c4f37f5d20e462c93560
  Using cached setuptools-36.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
  Found existing installation: setuptools 12.0.5
    Uninstalling setuptools-12.0.5:
      Successfully uninstalled setuptools-12.0.5

  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Successfully uninstalled pip-6.0.8

Successfully installed pip-9.0.1 setuptools-36.0.1
(reproducer)$ pip install scipy
Collecting scipy
  Using cached scipy-0.19.1-cp27-cp27mu-manylinux1_x86_64.whl
Collecting numpy>=1.8.2 (from scipy)
  Using cached numpy-1.13.0-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: numpy, scipy
Successfully installed numpy-1.13.0 scipy-0.19.1
(reproducer)$ ldd reproducer/lib64/python2.7/site-packages/scipy/special/_ufuncs.so
	linux-vdso.so.1 =>  (0x00007ffdbd1e2000)
	libopenblasp-r0-39a31c03.2.18.so => /home/ec2-user/reproducer/lib64/python2.7/site-packages/scipy/special/../.libs/libopenblasp-r0-39a31c03.2.18.so (0x00007f447ea8f000)
	libgfortran-ed201abd.so.3.0.0 => /home/ec2-user/reproducer/lib64/python2.7/site-packages/scipy/special/../.libs/libgfortran-ed201abd.so.3.0.0 (0x00007f447e794000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f447e48a000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f447e274000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f447deb1000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f447dc95000)
	/lib64/ld-linux-x86-64.so.2 (0x000055b50199b000)
(reproducer)$ python
Python 2.7.12 (default, Sep  1 2016, 22:14:00)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.special import logit
>>> ^D
(reproducer)$ strip reproducer/lib64/python2.7/site-packages/scipy/special/_ufuncs.so
(reproducer)$ ldd reproducer/lib64/python2.7/site-packages/scipy/special/_ufuncs.so
	not a dynamic executable
(reproducer)$ python
Python 2.7.12 (default, Sep  1 2016, 22:14:00)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.special import logit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ec2-user/reproducer/local/lib64/python2.7/site-packages/scipy/special/__init__.py", line 640, in <module>
    from ._ufuncs import *
ImportError: /home/ec2-user/reproducer/local/lib64/python2.7/site-packages/scipy/special/_ufuncs.so: ELF load command address/offset not properly aligned
>>> ^D
(reproducer)$ ^D

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