Tue 14 Dec 2010 05:13:14 PM UTC, original submission:
The linking stage of the 'lib' directory fails with SunStudio 12.1 on Solaris 10 Sparc and Oracle Solaris Studio 12.2 on Solaris 11 Express Sparc with the following message:
CC -G -o libmysqlpp.so.3 mysqlpp_beemutex.o mysqlpp_cmdline.o mysqlpp_connection.o mysqlpp_cpool.o mysqlpp_datetime.o mysqlpp_dbdriver.o mysqlpp_field_names.o mysqlpp_field_types.o mysqlpp_manip.o mysqlpp_myset.o mysqlpp_mysql++.o mysqlpp_mystring.o mysqlpp_null.o mysqlpp_options.o mysqlpp_qparms.o mysqlpp_query.o mysqlpp_result.o mysqlpp_row.o mysqlpp_scopedconnection.o mysqlpp_sql_buffer.o mysqlpp_sqlstream.o mysqlpp_ssqls2.o mysqlpp_stadapter.o mysqlpp_tcp_connection.o mysqlpp_transaction.o mysqlpp_type_info.o mysqlpp_uds_connection.o mysqlpp_utility.o mysqlpp_vallist.o mysqlpp_wnp_connection.o -h libmysqlpp.so.3 -lmysqlclient -lnsl -lsocket -lm -lz -L/opt/pd/mysql5/lib -lintl -lnsl -lsocket
ld: fatal: library -lmysqlclient: not found
ld: fatal: File processing errors. No output written to libmysqlpp.so.3
However the mysqlclient library can be found in '/opt/pd/mysql5/lib'. The problem is that the -L option which points to the directory comes after the -l that includes the library, whereas the Sun Studio linker requires that first the search path is given and after that the library that can be found with that search path.
The Makefile has the following lines to build the libmysqlpp.so library:
$(DLLPREFIX)mysqlpp$(__mysqlpp___targetsuf3): $(MYSQLPP_OBJECTS) lib/ssqls.h lib/querydef.h
$(SHARED_LD_CXX) $@ $(MYSQLPP_OBJECTS) $(__mysqlpp___importlib) $(__mysqlpp___soname_flags) $(__mysqlpp___macinstnamecmd) -lmysqlclient -lnsl -lsocket -lm -lz $(LDFLAGS) $(LIBS)
Now I set the location of the mysqlclient library during configuration:
./configure --with-mysql=/opt/pd/mysql5
I updated the Makefile and moved the $(LDFLAGS) in front of the -lmysqlclient switch. This fixed the issue. Then unfortunately I had to do the same thing with all other linkings.
I suppose the Makefile is created via bakefile and automake, but I have not been able to find a way to change the order of the linker flags.
|