Description:
On Mac OS X, the binary distribution packages install the libraries and headers into the wrong location.
When we build, we configure the dynamic libraries to be installed into $PREFIX/lib/mysql. But the script that makes a binary distribution (make_binary_distribution) actually copies the files into $PREFIX/lib. Similarly, headers are configured for $PREFIX/include/mysql but are installed into $PREFIX/include.
When building an application that relies on mysql_config and the libmysqlclient the dynamic library is located, but the library location is actually wrong.
Those users who build from source wont have the same issue - the installation scripts correctly install everything into the directories and place them where they should. It's only our binary distributions that are affected by this.
This affects programs which rely on the dynamic libraries, including DBD::mysql.
Possibly related bugs: #30148 and #30785
How to repeat:
1) Install MySQL from a Mac OS X binary package.
2) Run mysql_config - it will report that headers and libraries are in /usr/local/mysql/include/mysql and /usr/local/mysql/lib/mysql.
3) Check /usr/local/mysql/lib - it will contain the libraries
4) Check the dynamic library configured install location with otool, it will show that the library has been configured for /usr/local/mysql/lib/mysql:
otool -L /usr/local/mysql/lib/libmysqlclient.dylib
/usr/local/mysql/lib/libmysqlclient.dylib:
/usr/local/mysql/lib/libmysqlclient.16.dylib (compatibility version 17.0.0, current version 17.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.5)
5) Confirm that the /usr/local/mysql/lib doesn't exist.
Suggested fix:
The simplest solution is just to add a line to make_binary_distribution that creates a link between the $PREFIX/lib/mysql and $PREFIX/lib and a similar process for the headers.
I suggest we add something like this to the section that copies libraries in make_binary_distribution:
if [$BASE_SYSTEM != "netware" ] ; then
(cd $BASE/lib ; ln -s . mysql)
fi
And a similar section immediately after:
copyfileto $BASE/include config.h include/*
if [$BASE_SYSTEM != "netware" ] ; then
(cd $BASE/include ; ln -s . mysql)
fi