Bug #31448 Mac OS X Binary Installations install libraries to the wrong directory
Submitted: 8 Oct 2007 13:08 Modified: 20 Oct 2007 11:13
Reporter: MC Brown Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.0, 5.1, 5.1.22 OS:Mac OS X
Assigned to: Assigned Account CPU Architecture:Any

[8 Oct 2007 13:08] MC Brown
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.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)

And a similar section immediately after:

copyfileto $BASE/include config.h include/* 

if [$BASE_SYSTEM != "netware" ] ; then
    (cd $BASE/include ; ln -s . mysql)
[19 Oct 2007 9:36] Sveta Smirnova
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Duplicate of bug #28544