Bug #6273 building fails on link
Submitted: 27 Oct 2004 2:14 Modified: 5 Feb 2005 1:44
Reporter: Peter Harvey Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1 OS:MacOS (OSX 10.3)
Assigned to: Konstantin Osipov CPU Architecture:Any

[27 Oct 2004 2:14] Peter Harvey
Description:
Installed MySQL 4.1.6 binary from dmg - no problem with this.

Trying to build MyODBC fails during 'configure' when an attempt is made to build a small test program. Looking at the config.log reveals a bad link line. The problem is that mysql_config includes a link option to bring in libz but it does this in way which only makes sense when building the server as the path is relative -- and presumably points to some sub-dir in the server source code - which is not installed.

How to repeat:
Clone the myodbc sources and try to build. Follow instructions in README.OSX.

Suggested fix:
OSX 10.3 comes with share libz in /usr/lib so putting it in the link line is fine just get rid of the rel. path.
[16 Nov 2004 21:43] Lenz Grimmer
I have now changed the build scripts to use the system zlib, if available. Now configure will only revert to the bundled zlib, if there is no system-installed library available. This should resolve the issue for systems like Mac OS X, where zlib is part of the the OS.

However, mysql_config needs to be fixed. I would propose that it should not include a reference to zlib at all, if we use the bundled zlib. Konstantin, what do you think?
[22 Nov 2004 13:47] Konstantin Osipov
Even if we use the bundled zlib, it's not compiled into libmysql, which still needs libz as far as I remember.
So I agree that mysql_config should not print path to the bundled zlib if it has been used,
but to fix this properly we maybe should install the bundled zlib to the mysql library path and 
fix mysql_config to point there.
[15 Jan 2005 2:09] Andy Dustman
I think this is relevant to this bug. In 4.1.8, mysql_config --libs_r does not include -lz, while --libs does. 4.0.22 works correctly:

andy@chef ~ $ mysql_config --version
4.0.22
andy@chef ~ $ mysql_config --libs
-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto
andy@chef ~ $ mysql_config --libs_r
-L/usr/lib/mysql -lmysqlclient_r -lpthread -lz -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto

andy@tweek andy $ mysql_config --version
4.1.8
andy@tweek andy $ mysql_config --libs
-L/usr/lib/mysql -lmysqlclient -lcrypt -lnsl -lm -lz -L/usr/lib -lssl -lcrypto
andy@tweek andy $ mysql_config --libs_r
-L/usr/lib/mysql -lmysqlclient_r -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto

Both of these systems are running Gentoo Linux on x86.
[31 Jan 2005 22:59] Konstantin Osipov
Subject: bk commit - 4.1 tree (konstantin:1.2147) BUG#6273

ChangeSet
  1.2147 05/02/01 01:56:00 konstantin@mysql.com +5 -0
  A fix for Bug#6273 "building fails on link": we should not use
  CLIENT_LIBS in mysql_config as CLIENT_LIBS point to builddir when
  we use the bundled zlib.
[4 Feb 2005 22:46] Konstantin Osipov
Pushed into 4.1 tree which is currently marked 4.1.10
[5 Feb 2005 1:44] Paul DuBois
Mentioned in 4.1.10 change notes.