Errors building GreenSQL 1.2.2 on Mac OS X 10.5.8 Leopard Server
I'm attempting to build GreenSQL 1.2.2 on Mac OS X 10.5.8 Leopard Server, but I get the following errors (which appear to be an ld
error?):
cc -g -Wall -I/usr/local/include/ -I/usr/include/mysql/ -I/usr/local/include/mysql/ -DHAVE_MYSQL_CLIENT -fPIC -c -Wall sql_api.c
cc -g -Wall -I/usr/local/include/ -L/usr/lib64/mysql -L/usr/local/lib/mysql -L/usr/lib/mysql -lmysqlclient -shared -Wl,-soname,libgsql-mysql.so.1 -DHAVE_MYSQL_CLIENT -o libgsql-mysql.so.1 sql_api.o
ld: unknown option: -soname
collect2: ld returned 1 exit status
make[2]: *** [api] Error 1
make[1]: *** [greensql-fw] Error 2
cp: greensql-fw: No such file or directory
make: *** [greensql-fw] Error 1
I have already built and installed (into /usr/local
) the following prerequisites: pcre 8.01, libevent 1.4.13-stable, as well as the MySQL client binaries & headers (per http://support.apple.com/kb/TA25017, although I installed MySQL-45.binaries.tar.gz as I'm on Mac OS X 10.5.8).
I'm pretty familiar with building open source software on Mac OS X, but I have to admit there are definitely a lot of ins and outs of command line compiling I do not know. I have not run into ld
errors before (and didn't see anything in the Makefile
that jumped out at me). I could not find mention of a -soname
option in the man page for ld
.
Any suggestions would be greatly appreciated.
Update #1: I found the occurrence of -soname
in src/lib/Makefile
, replaced it with -install_name
and got a little further. Now I get the following:
cc -g -Wall -I/usr/local/include/ -I/usr/include/mysql/ -I/usr/local/include/mysql/ -DHAVE_MYSQL_CLIENT -fPIC -c -Wall sql_api.c
cc -g -Wall -I/usr/local/include/ -L/usr/lib64/mysql -L/usr/local/lib/mysql -L/usr/lib/mysql -lmysqlclient -shared -Wl,-install_name,libgsql-mysql.so.1 -DHAVE_MYSQL_CLIENT -o libgsql-mysql.so.1 sql_api.o
Undefined symbols:
"_compress", referenced from:
_my_compress_alloc in libmysqlclient.a(my_compress.o)
_my_compress in libmysqlclient.a(my_compress.o)
"_main", referenced from:
start in crt1.10.5.o
"_uncompress", referenced from:
_my_uncompress in libmysqlclient.a(my_compress.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [api] Error 1
make[1]: *** [greensql-fw] Error 2
cp: greensql-fw: No such file or directory
make: *** [greensql-fw] Error 1
Upda开发者_如何学Cte #2: Further edits to src/lib/Makefile
, this time adding -lz
to the end of CXXFLAGS
gets past the compression errors. The errors are now as follows:
cc -g -Wall -I/usr/local/include/ -lz -I/usr/include/mysql/ -I/usr/local/include/mysql/ -DHAVE_MYSQL_CLIENT -fPIC -c -Wall sql_api.c
i686-apple-darwin9-gcc-4.0.1: -lz: linker input file unused because linking not done
cc -g -Wall -I/usr/local/include/ -lz -L/usr/lib64/mysql -L/usr/local/lib/mysql -L/usr/lib/mysql -lmysqlclient -shared -Wl,-install_name,libgsql-mysql.so.1 -DHAVE_MYSQL_CLIENT -o libgsql-mysql.so.1 sql_api.o
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [api] Error 1
make[1]: *** [greensql-fw] Error 2
cp: greensql-fw: No such file or directory
make: *** [greensql-fw] Error 1
Edited: answered a little too fast... so removed original answer.
Try with -dylib_install_name
instead of -so_name
(and have dylib
as extension instead of .so
).
精彩评论