I am running on Solaris and I was trying to compile an application that used the libmysqlclient.a library.

I encountered an error:

Undefined first referenced
symbol in file
socket /usr/local/mysql4/lib/libmysqlclient.a(libmysql.o)
getpeername /usr/local/mysql4/lib/libmysqlclient.a(viosocket.o)
setsockopt /usr/local/mysql4/lib/libmysqlclient.a(viosocket.o)
getservbyname /usr/local/mysql4/lib/libmysqlclient.a(libmysql.o)
getsockopt /usr/local/mysql4/lib/libmysqlclient.a(libmysql.o)
shutdown /usr/local/mysql4/lib/libmysqlclient.a(viosocket.o)
connect /usr/local/mysql4/lib/libmysqlclient.a(libmysql.o)
ld: fatal: Symbol referencing errors.



Now the solution was to add a -lsocket to the linking options.
But, should this not be something that autoconf or automake suite of tools detect and automatically handle for me? Do I need to manually add this only when I run on Solaris?


Now that I do need to handle this. Where is the best place to check the OS environment variable to see if I need to set this as a variable somewhere. I wanted to do something like:

ifeq ($(OSTYPE),solaris)
     export SOCKET = -lsocket
endif

Do I do this in configure.in somehow or in Makefile.am? Is there a better way anyone can suggest. I would think something like this is a common problem to handle.

Thanks,
John Ling





Reply via email to