List:MySQL++« Previous MessageNext Message »
From:David Gamez Date:December 20 2005 11:16am
Subject:Re: Link problems when building on SUSE 10
View as plain text  
It was not a deliberate choice to link to libmysqlclient.a instead of libmysqlclient.la -
just what happened when I complied the code. I have tried several things to try to get
around the problem, none of which have worked. 

1: I renamed libmysqlclient.a to libmysqlclient.olda so that it could not be used and
modified mysql_loc.m4 to look for libmysqlclient.la instead of libmysqlclient.a. This did
not work and from what I remember it gave the same error as before.


2: I tried altering the command that was causing the problem. The original version was: 

gcc -shared  coldata.lo connection.lo datetime.lo fields.lo field_names.lo field_types.lo
manip.lo myset.lo qparms.lo query.lo result.lo row.lo sql_string.lo string_util.lo
type_info.lo vallist.lo -Wl,--whole-archive /usr/lib64/mysql/libmysqlclient.a
-Wl,--no-whole-archive  -L/usr/lib64/mysql -lz  -Wl,-soname -Wl,libmysqlpp.so.2 -o
.libs/libmysqlpp.so.2.0.7

And I changed it to: 

gcc -shared  coldata.lo connection.lo datetime.lo fields.lo field_names.lo field_types.lo
manip.lo myset.lo qparms.lo query.lo result.lo row.lo sql_string.lo string_util.lo
type_info.lo vallist.lo -Wl,--whole-archive /usr/lib64/mysql/libmysqlclient.la
-Wl,--no-whole-archive  -L/usr/lib64/mysql -lz  -Wl,-soname -Wl,libmysqlpp.so.2 -o
.libs/libmysqlpp.so.2.0.7

This gave the following error: /usr/lib64/mysql/libmysqlclient.la: file not recognized:
File format not recognized


3: I installed the latest build of MySQL - version 5.0.17 - in the hope that if this was
causing the problem it might have been fixed. This created a similar error to my original
problem, except that it was now connected with libz.a - I think MySQL have changed the way
they have handled this library, but am vague on the details. The error was as follows:

gcc -shared  coldata.lo connection.lo datetime.lo fields.lo field_names.lo field_types.lo
manip.lo myset.lo qparms.lo query.lo result.lo row.lo sql_string.lo string_util.lo
type_info.lo vallist.lo -Wl,--whole-archive /usr/lib64/mysql/libz.a
/usr/lib64/mysql/libmysqlclient.a -Wl,--no-whole-archive  -L/usr/lib64/mysql  -Wl,-soname
-Wl,libmysqlpp.so.2 -o .libs/libmysqlpp.so.2.0.7
/usr/lib64/gcc/x86_64-suse-linux/4.0.2/../../../../x86_64-suse-linux/bin/ld:
/usr/lib64/mysql/libz.a(compress.o): relocation R_X86_64_32 against `a local symbol' can
not be used when making a shared object; recompile with -fPIC
/usr/lib64/mysql/libz.a(compress.o): could not read symbols: Bad value


4. Again I tried replacing libz.a with libz.la and re-executing the command. The command
was as follows: 

davidg@VIGLEN1:~/Programs/mysqlpp/mysql++-2.0.7/lib> gcc -shared  coldata.lo
connection.lo datetime.lo fields.lo field_names.lo field_types.lo manip.lo myset.lo
qparms.lo query.lo result.lo row.lo sql_string.lo string_util.lo type_info.lo vallist.lo
-Wl,--whole-archive /usr/lib64/mysql/libz.la /usr/lib64/mysql/libmysqlclient.a
-Wl,--no-whole-archive  -L/usr/lib64/mysql  -Wl,-soname -Wl,libmysqlpp.so.2 -o
.libs/libmysqlpp.so.2.0.7

And the error was very similar: /usr/lib64/mysql/libz.la: file not recognized: File format
not recognized


Any suggestions about what else I could try? I am fairly new to Linux so may be missing
something obvious. Could the linking process be trying to connect 32 and 64 bit libraries
or something similar? Do you think that changing to the 32 bit version of SUSE 10 might
solve the problem? 
plusplus@stripped@lists.mysql.complusplus@stripped
Many thanks

David



-----Original Message-----
From: Warren Young [mailto:mysqlpp@stripped]
Sent: Tue 12/20/2005 07:36
To: MySQL++ Mailing List
Subject: Re: Link problems when building on SUSE 10
 
Gamez, David wrote:
> 
> Could the problem be connected with libtools trying to link to
> libmysqlclient.a instead of libmysqlclient.la and is this the
> 'recompliation' that is requested when it says 'recompile with
> -fPIC'?

It's possible.  It may be especially problematic if you build MySQL++ 
dynamically against the MySQL C API library, and then statically link to 
it when building your program.

Why are you trying to link to a static version of the MySQL C API 
library anyway?

P.S., I've replied to the mailing list.  Please keep this sort of 
discussion there.

-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=1




Thread
Link problems when building on SUSE 10David Gamez14 Dec
  • Re: Link problems when building on SUSE 10Warren Young15 Dec
Re: Link problems when building on SUSE 10Warren Young20 Dec
Re: Link problems when building on SUSE 10David Gamez20 Dec
  • Re: Link problems when building on SUSE 10Warren Young20 Dec
RE: Link problems when building on SUSE 10David Gamez20 Dec
  • Re: Link problems when building on SUSE 10Tommy Apel20 Dec
    • Re: Link problems when building on SUSE 10Warren Young20 Dec
      • Re: Link problems when building on SUSE 10Tommy Apel20 Dec