Skip to content

Requires package libssl-dev #341

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

Closed
mangelozzi opened this issue Mar 12, 2019 · 8 comments · Fixed by #409
Closed

Requires package libssl-dev #341

mangelozzi opened this issue Mar 12, 2019 · 8 comments · Fixed by #409

Comments

@mangelozzi
Copy link

After many hours I eventually got it to install by installing this package:
sudo apt install libssl-dev

I am using Ubuntu 18.04 server edition.
I think it may greatly help if it is set as a dependency when installing.
Sorry but this is the only way I could find to contact the project (and I think it may help many others).

Here the log of the error I was getting before installing lissl-dev:
/usr/lib/x86_64-linux-gnu$ python3.6 -m pip install mysqlclient

Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-6kx2ssuh/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/pip-wheel-mn8gp61r --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/init.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb.mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,2,'post',1) -D__version
=1.4.2.post1 -I/usr/include/mysql -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lm -lrt -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-6kx2ssuh/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-euww16vg/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/init.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb.mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,2,'post',1) -D__version
=1.4.2.post1 -I/usr/include/mysql -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lm -lrt -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-6kx2ssuh/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-euww16vg/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-6kx2ssuh/mysqlclient/

@methane
Copy link
Member

methane commented Mar 12, 2019

I can build mysqlclient-python without libssl-dev, on Ubuntu 18.04.
You couldn't build it because lack of libssl and libcrypto. They are installed when you installed libssl-dev.

I don't know how did you install MySQL and Ubuntu 18.04.
ssl and crypto is very basic package. Your environment is special.

If you want to document about it, please file a bug on MySQL side.
libmysqlclient (aka. MySQL Connector/C) depends them.

Both are not direct dependency of mysqlclient-python.
Actually speaking, you can build ssl free version of libmysqlclient and mysqlclient-python.

@methane methane closed this as completed Mar 12, 2019
@methane
Copy link
Member

methane commented Mar 12, 2019

Ah, note that ssl is used by Python too.
I don't want waste my time to list all indirect dependency up for various (thousands, or millions of) environment. If you want to use special environment, you should fix your trouble by yourself.

@mangelozzi
Copy link
Author

Not using a special environment. Just using standard Ubuntu server 18.04, and the version of python 3.6 it comes with.

@methane
Copy link
Member

methane commented Mar 13, 2019

libpython3.6-minimal depends on libssl
https://packages.ubuntu.com/en/bionic/libpython3.6-minimal

Many other basic tools (e.g. wget, ssh, etc) also depends on libssl.
I can't believe standard Ubuntu server installation don't have libssl.
You did something uncommon.

@methane
Copy link
Member

methane commented Mar 13, 2019

If you think it's really issue, provide "complete step to reproduce" information, from clean install Ubuntu Server into new VM.

I don't want to waste my time to try it.

@ciarancourtney
Copy link

FYI this is still an issue on latest bionic images on ec2, which come with a default python3.6 install

@methane
Copy link
Member

methane commented Nov 29, 2019

Repeat: If you think it's really issue, provide "complete step to reproduce" information, from clean install Ubuntu Server into new VM.

@methane
Copy link
Member

methane commented Nov 29, 2019

OK, I confirmed it.

  • mysql_config adds -lcrypto -lssl, while they are not needed when dynamic linking -lmysqlclient.
  • libssl1.1 package provides libssl.so.1.1, and ssl-dev package provides libssl.so -> libssl.so.1.1 symlink.

This is why ssl-dev is needed in build time while the _mysql module doesn't use crypto or ssl.
I removed -lcrypto -lssl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants