So I've been working on compiling a static version of MySQL and MySQLclient-python. I've been completely successful up to this point where I'm trying to understand a libSystem.B.dylib dependency that MySQLclient-python has.
To make it clear, MySQLclient-python is a python wrapper around the MySQL C Library. This results in the need to compile MySQLclient-python before it is used. This is currently working on OS X 10.7, and my goal is to create a compiled version of MySQLclient-python that will work on multiple versions of OS X (bundling libmysql is already taken care of). Right now, I am compiling MySQLclient-python perfectly fine, and it works on 10.7. However, when it's testing on 10.8+, it breaks. To compile MySQLclient-python, I'm using python 3.5 and running
python setup.py build
This results in two things happening. First, a _mysql.o object file is compiled using a command similar to this. Then, a shared object file is compiled using this script. To be clear, those commands are mostly generated by setup.py.
The resulting build has the structure
.
├── setup.py
└── build
├── _mysql.so
├── MySQLdb
└── _mysql_exceptions.py
Now, when running
$ otool -L _mysql.so
_mysql.so: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
It clearly shows there's a dependency on libSystem.B.dylib. Now dependencies aren't an issue in general, and this works fine on 10.7. I can import the python module and use it correctly. However, when switching to 10.11, this same module no produces a:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "./MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(./_mysql.so, 2): Symbol not found: __ZNSt8ios_base4InitD1Ev
Referenced from: ./_mysql.so
Expected in: flat namespace in ./_mysql.so
Obviously, my first thought is that there's a problem with the dependency. I do believe that is the issue. To be honest though, I'm not sure where to go from here. Obviously, OS X strongly discourages static linking, so I didn't look into that for long. Just to be clear once more, my goal is just to be able to use this on multiple OS X platforms (10.7-10.11) and this currently works on 10.7. Any ideas?