Bug #2784 libmysqld 4.1.1-alpha doesn't work on MacOS X because of linker error
Submitted: 13 Feb 2004 17:45 Modified: 23 Mar 2004 14:41
Reporter: Simson Garfinkel Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S1 (Critical)
Version:4.1.1-alpha OS:MacOS (MacOS X 10.3)
Assigned to: Bugs System CPU Architecture:Any

[13 Feb 2004 17:45] Simson Garfinkel
Description:
Trying to link a program with libmysqld on MacOS 10.3, I get this error:

ld: warning multiple definitions of symbol _qsort
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libmysys_mf_qsort.o) definition of _qsort 
in section (__TEXT\
,__text)
/usr/lib/libSystem.dylib(qsort.So) definition of _qsort
ld: warning multiple definitions of symbol _regcomp
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libregex_regcomp.o) definition of 
_regcomp in section (__TEX\
T,__text)
/usr/lib/libSystem.dylib(regcomp.So) definition of _regcomp
ld: warning multiple definitions of symbol _regexec
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libregex_regexec.o) definition of _regexec 
in section (__TEX\
T,__text)
/usr/lib/libSystem.dylib(regexec.So) definition of _regexec
ld: warning multiple definitions of symbol _regfree
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libregex_regfree.o) definition of _regfree 
in section (__TEX\
T,__text)
/usr/lib/libSystem.dylib(regfree.So) definition of _regfree
ld: Undefined symbols:

So it looks like the library is being called out of libmysqld.a and is conflicting with what's in the system 
libSystem.dylib.  This is probably a MacOS-related bug, and I'll be filing a linker error with Apple's 
bugreporter, too. Next I'll specifically remove these modules from the MacOS libmysqld.a and see if the 
errors go away.

How to repeat:
"dm" is any test program.

make -k dm
g++-3.3 -o dm dm.o ../lib/libstream.a /Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a 
-L../lib -lstream -lss\
l -lcrypto
ld: warning multiple definitions of symbol _qsort
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libmysys_mf_qsort.o) definition of _qsort 
in section (__TEXT\
,__text)
/usr/lib/libSystem.dylib(qsort.So) definition of _qsort
ld: warning multiple definitions of symbol _regcomp
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libregex_regcomp.o) definition of 
_regcomp in section (__TEX\
T,__text)
/usr/lib/libSystem.dylib(regcomp.So) definition of _regcomp
ld: warning multiple definitions of symbol _regexec
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libregex_regexec.o) definition of _regexec 
in section (__TEX\
T,__text)
/usr/lib/libSystem.dylib(regexec.So) definition of _regexec
ld: warning multiple definitions of symbol _regfree
/Users/simsong/mysql-4.1.1-alpha//libmysqld/libmysqld.a(libregex_regfree.o) definition of _regfree 
in section (__TEX\
T,__text)
/usr/lib/libSystem.dylib(regfree.So) definition of _regfree
ld: Undefined symbols:
_compress
_uncompress
_crc32
make: *** [dm] Error 1
[23 Mar 2004 14:41] Greg Weir
Using g++ to link with libmysqld and/or libmysql is not recommended; g++ includes template and system libraries that both conflict with symbols in our libraries and alter the behaviour of the libraries. It may be possible to force such a program to compile, but it will probably not work correctly. 

We recommend the use of gcc to link to libmysqld, on all platforms.