Bug #11582 Issue with building 4.1.12 on Darwin 8.1.0
Submitted: 26 Jun 2005 2:46 Modified: 19 Sep 2005 18:16
Reporter: Shiloh Heurich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1.12 OS:MacOS (Mac OS X 10.4.1)
Assigned to: CPU Architecture:Any

[26 Jun 2005 2:46] Shiloh Heurich
Description:
I am having difficulty building MySQL 4.1.12 under Darwin 8.1.0 [Mac OS X 10.4.1 - Build 8B15] using Xcode 2.1 tools [powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. build 5026)]. 

The problem surfaces when compiling the file item_strfunc.cc. It appears to be related to the crypt() function provided by OpenSSL. 

This is the line of output from when the compiler dies :

if gcc -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/usr/local/mysql\"" -DDATADIR="\"/var/mysql\"" -DSHAREDIR="\"/usr/local/mysql/share/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../innobase/include -I../include -I../regex -I.     -g -O -DDBUG_ON -DSAFE_MUTEX -O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti   -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 item_strfunc.o -MD -MP -MF ".deps/item_strfunc.Tpo" -c -o item_strfunc.o item_strfunc.cc; \
then mv -f ".deps/item_strfunc.Tpo" ".deps/item_strfunc.Po"; else rm -f ".deps/item_strfunc.Tpo"; exit 1; fi
[...]
item_strfunc.cc: In member function 'virtual String* Item_func_encrypt::val_str(String*)':
item_strfunc.cc:1460: error: 'crypt' was not declared in this scope
[...]
make[4]: *** [item_strfunc.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

How to repeat:
The following is my build command :

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/mysql --with-unix-socket-path=/tmp/mysql.sock --with-openssl=/usr --with-mysqld-user=mysql --with-comment --with-extra-charsets=complex --with-debug --enable-thread-safe-client --enable-local-infile --disable-shared

Suggested fix:
First I removed the argument '--with-openssl=/usr'. This resulted in linker errors (specifically undefined new() and delete() functions), which I believe were the result of setting 'CXX=gcc' (instead of the default => g++). 

So, after removing OpenSSL support and using the default compilers for C and CXX, I arrived at the following build command :

CFLAGS="-O3 -fno-omit-frame-pointer" CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/mysql --with-unix-socket-path=/tmp/mysql.sock --with-mysqld-user=mysql --with-comment --with-extra-charsets=complex --with-debug --enable-thread-safe-client --enable-local-infile --disable-shared

This works correctly on Darwin 8.1.0 / gcc 4.0.
[28 Jul 2005 18:09] Patrick Galbraith
Looking into this. Not sure what is meant by building under xcode. I use xcode on Darwin 7.9.0, and once I have a successfull build, all subsequent builds using the 'build and debug' option are simply done via 'make' (which uses the settings from the build). However, I will find a 8.1.0 Darwin platform to test.
[19 Sep 2005 18:16] Shiloh Heurich
Version 4.1.14 builds correctly with Xcode 2.1 (gcc 4.0.0 build 5026) on Mac OS X 10.4.2.