Bug #12288 Build fails - can't locate file for: -lgcc_s

Submitted: 30 Jul 2005 22:38 Modified: 1 Apr 2006 5:23
Reporter: Matisse Enzer Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.13 OS:MacOS (Mac OS X 10.4.2)
Assigned to: Kent Boortz CPU Architecture:Any

[30 Jul 2005 22:38] Matisse Enzer
Description:
Trying to compile MySQL 4.1.13 on Mac OS X 10.4.2
gcc_select show gcc 4.0.0:
$ gcc_select
Current default compiler:
gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)
localhost:/usr/local/src/mysql/mysql-4.1.13 vanilla$ locate gcc_s
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc_s.dylib
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc_static.a
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libgcc_s_ppc64.dylib
/usr/sbin/gcc_select
/usr/share/man/man8/gcc_select.8
localhost:/usr/local/src/mysql/mysql-4.1.13 vanilla$ gcc_select
Current default compiler:
gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)

The build fails with:
...
Making all in sql
if g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/local/mysql\"" -DDATADIR="\"/usr/local/mysql/var\"" -DSHAREDIR="\"/usr/local/mysql/share/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../innobase/include -I../include -I../include -I../regex -I.     -O3 -DDBUG_OFF    -fno-implicit-templates -fno-exceptions -fno-rtti -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -MT gen_lex_hash.o -MD -MP -MF ".deps/gen_lex_hash.Tpo" -c -o gen_lex_hash.o gen_lex_hash.cc; \
then mv -f ".deps/gen_lex_hash.Tpo" ".deps/gen_lex_hash.Po"; else rm -f ".deps/gen_lex_hash.Tpo"; exit 1; fi
/bin/sh ../libtool --preserve-dup-deps --mode=link g++  -O3 -DDBUG_OFF    -fno-implicit-templates -fno-exceptions -fno-rtti -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT   -o gen_lex_hash  gen_lex_hash.o ../myisam/libmyisam.a ../myisammrg/libmyisammrg.a ../heap/libheap.a ../vio/libvio.a ../mysys/libmysys.a ../dbug/libdbug.a ../regex/libregex.a ../strings/libmystrings.a -lz   -lm  
mkdir .libs
g++ -O3 -DDBUG_OFF -fno-implicit-templates -fno-exceptions -fno-rtti -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -o gen_lex_hash gen_lex_hash.o -Wl,-bind_at_load  ../myisam/libmyisam.a ../myisammrg/libmyisammrg.a ../heap/libheap.a ../vio/libvio.a ../mysys/libmysys.a ../dbug/libdbug.a ../regex/libregex.a ../strings/libmystrings.a -lz -lm
/usr/bin/ld: can't locate file for: -lgcc_s
collect2: ld returned 1 exit status
make[2]: *** [gen_lex_hash] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

How to repeat:
Use source distribution mysql-4.1.13.tar.gz

$ tar xfvz mysql-4.1.13.tar.gz
$ cd mysql-4.1.13
$ ./configure --prefix=/usr/local/mysql
$ make

Build fails.

Suggested fix:
None known yet.
[31 Jul 2005 18:43] Jorge del Conde
Thanks for your bug report.

I was able to reproduce this bug using 10.4.2 and gcc4
[31 Jul 2005 22:38] Matisse Enzer
A work-around is to use the Installer Package for Mac OS X 10.3, which seems to work under 10.4.2.
[10 Aug 2005 11:53] Brian Vowell
I'm experiencing the EXACT same failure with the 5.0.10 source code.  I'm compiling with GCC 4.0.1 and GNUbinutils 2.16 on Solaris 10 x86 (32-bit).
[1 Nov 2005 14:33] Giuliano Gavazzi
the problem with ctr0 appears to stem from the use of the -static option. I got rid of that and it succeeds, albeit with some warning:

ld: warning multiple definitions of symbol _qsort
../mysys/libmysys.a(mf_qsort.o) definition of _qsort in section (__TEXT,__text)
/usr/lib/libm.dylib(qsort.So) definition of _qsort

gcc_select 
Current default compiler:
gcc version 3.3 20030304 (Apple Computer, Inc. build 1640)

sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.3.9
BuildVersion:   7W98
[1 Nov 2005 14:34] Giuliano Gavazzi
forgot: mysql-5.0.15
[1 Nov 2005 15:20] Giuliano Gavazzi
Solution, at least for the configuration above, seems to be to remove --with-mysqld-ldflags=-all-static from the configure options. For instance instead of:

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
            -fno-exceptions -fno-rtti" ./configure \
            --prefix=/usr/local/mysql --enable-assembler \
            --with-mysqld-ldflags=-all-static

use

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
            -fno-exceptions -fno-rtti" ./configure \
            --prefix=/usr/local/mysql --enable-assembler
[9 Nov 2005 13:50] Joerg Bruehe
Note that you had two changes in your last attempt:
1) Dropping "static"
2) Changing the compiler/linker front-end (for C++) from "g++" to "gcc".

All MySQL release builds (which use "gcc") are done using "gcc" even for C++, not "g++".
This does not have effects on the individual object module, but it changes the default
library list at link time.
In this way, the accidental of expensive C++ runtime functions is avoided.

I propose you add "CXX=gcc" to any "configure" call you use for MySQL builds.
[1 Apr 2006 5:23] Kent Boortz
Build works on Mac OS X 10.4, MySQL 5.0.19 and
"gcc version 4.0.0 (Apple Computer, Inc. build 5026)"

  tar -xzf mysql-5.0.19.tar.gz
  cd mysql-5.0.19
  export PATH=/usr/bin:/bin
  ./configure --prefix=/usr/local/mysql
  make
[9 Feb 2007 16:12] Vladimir Kolesnikov
the problem seems to affect only intel boxes... at least I get the same problem on my mac mini as well, while ppl on ppc dont

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.