[Wheel-builders] Help with building/using MySQL-python-embedded

Amit Saha amitsaha.in at gmail.com
Tue Sep 20 03:14:10 EDT 2016


On Fri, Sep 16, 2016 at 2:42 PM, Amit Saha <amitsaha.in at gmail.com> wrote:
> Hi all,
>
> I am trying to build manylinux1 wheels for
> https://pypi.python.org/pypi/MySQL-python-embedded/1.2.5
>
> Here is my script which I am running inside the build container:
>
> #!/bin/bash
> # Script modified from https://github.com/pypa/python-manylinux-demo
> set -e -x
>
> yum install -y make zlib-devel openssl-devel libaio libaio-devel
>
> wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.51.tar.gz/from/http://mysql.he.net/
> tar -zxvf mysql-5.1.51.tar.gz
> cd /mysql-5.1.51
> CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure
> make install
> cd libmysqld
> make install
> cd /
>
> # Compile wheels
> for PYBIN in /opt/python/cp27*/bin; do
>     LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/mysql ${PYBIN}/pip
> install MySQL-Python==1.2.5 --no-index -f /mysql-python-wheels
>     LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/mysql ${PYBIN}/pip
> wheel /workspace/ -w wheelhouse/
> done
>
> # Bundle external shared libraries into the wheels
> #ls wheelhouse/*
> for whl in wheelhouse/*linux*.whl; do
>     LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/mysql auditwheel
> repair $whl -w /workspace/wheelhouse/
> done
>
> # Install packages and test
> for PYBIN in /opt/python/cp27*/bin/; do
>     ${PYBIN}/pip install --no-index mysql-python-embedded -f
> /workspace/wheelhouse
>     ${PYBIN}/python -c "import MySQLdb_embedded;
> MySQLdb_embedded.start_server()" || true
> done
>
>
>
> The wheels build fine (example):
>
> Building wheels for collected packages: MySQL-python-embedded, MySQL-python
>   Running setup.py bdist_wheel for MySQL-python-embedded ... done
>   Stored in directory: /wheelhouse
>   Running setup.py bdist_wheel for MySQL-python ... done
>   Stored in directory: /wheelhouse
> Successfully built MySQL-python-embedded MySQL-python
> + for whl in 'wheelhouse/*linux*.whl'
> + LD_LIBRARY_PATH=/opt/rh/devtoolset-2/root/usr/lib64:/opt/rh/devtoolset-2/root/usr/lib:/usr/local/lib64:/usr/local/lib:/usr/local/lib/mysql
> + auditwheel repair
> wheelhouse/MySQL_python-1.2.5-cp27-cp27m-linux_x86_64.whl -w
> /workspace/wheelhouse/
> Repairing MySQL_python-1.2.5-cp27-cp27m-linux_x86_64.whl
> Grafting: /lib64/libz.so.1.2.3 -> .libs_mysql/libz-a147dcb0.so.1.2.3
> Grafting: /usr/local/lib/mysql/libmysqlclient_r.so.16.0.0 ->
> .libs_mysql/libmysqlclient_r-0bea0d7c.so.16.0.0
> Setting RPATH: _mysql.so to "$ORIGIN/.libs_mysql"
> Previous filename tags: linux_x86_64
> New filename tags: manylinux1_x86_64
> Previous WHEEL info tags: cp27-cp27m-linux_x86_64
> New WHEEL info tags: cp27-cp27m-manylinux1_x86_64
>
> Fixed-up wheel written to
> /workspace/wheelhouse/MySQL_python-1.2.5-cp27-cp27m-manylinux1_x86_64.whl
>
>
> Now when I import it inside the same build container:
>
>  /opt/python/cp27-cp27mu/bin//python -c 'import MySQLdb_embedded;
> MySQLdb_embedded.start_server()'
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "/opt/python/cp27-cp27mu/lib/python2.7/site-packages/MySQLdb_embedded/__init__.py",
> line 12, in <module>
>     import _mysql_embedded
> ImportError: /opt/python/cp27-cp27mu/lib/python2.7/site-packages/_mysql_embedded.so:
> undefined symbol: __cxa_pure_virtual
>
>
> The reason I download and compile mysql 5.151 from source is mysql
> python embedded needs to statically link to the libmysqld.a library
> which on CentOS5 can only be done as far as I have found out by hand
> compiling above. This is also the reason I use CFLAGS=-fPIC
> CXXFLAGS=-fPIC when running configure.
>
> Not sure what I am doing wrong or what I should be looking at next.
> Any suggestions will be greatly appreciated.

I looked into it again, and I can see that (via readelf), the created
_mysql_embedded.so links to the following libraries:

0x0000000000000001 (NEEDED)             Shared library: [libz-a147dcb0.so.1.2.3]
0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
0x0000000000000001 (NEEDED)             Shared library: [libcrypt.so.1]
0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED)             Shared library:
[libaio-f5693f09.so.1.0.1]
0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]


The libz-a1xx and libaio-xx libraries are not in the list here at
https://www.python.org/dev/peps/pep-0513/

Does this mean, I am creating incompatible wheels?




>
> Thank you.
>
> Best Wishes,
> Amit.
>
>
> --
> http://echorand.me



-- 
http://echorand.me


More information about the Wheel-builders mailing list