Bug #18091 libmysqlclient.a relocation error
Submitted: 9 Mar 2006 2:41 Modified: 9 Jun 2006 18:39
Reporter: Gordon Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S1 (Critical)
Version:5.0.21, 5.0.18 OS:Linux (RHEL4, FC4 X86_64)
Assigned to: Kent Boortz CPU Architecture:Any

[9 Mar 2006 2:41] Gordon Smith
Description:
Package affected is MySQL-devel-standard-5.0.18-0.rhel4

Linking to libmysqlclient.a produces the following error:

/usr/lib64/mysql/libmysqlclient.a(libmysql.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

Position independent code fault. 
Platform is an AMD server - all the MySQL packages are 64-bit RPM's

How to repeat:
Discovered while compiling Asterisk add-on module for MySQL integration.

Suggested fix:
Recompile library with -fPIC flag set
[9 Mar 2006 11:57] Valeriy Kravchuk
Thank you for the problem report. According to our build team, it is a know problem that will be fixed eventually.
[9 Mar 2006 11:57] Kent Boortz
This is a common feature request and will be addressed
soon.

As position independent code (PIC) is slower on some
platforms we need to make sure only the client
code is compiled with PIC flags. The client library is
not performance critical in the same way as the server.

So this is to make sure we in one or separate builds
compile all objects to be in the "libmysqlclient.a" library
with PIC flags.
[12 Apr 2006 22:33] Andrei Nazarenko
I am compiling PHP against MySQL on 64 bit OpenSuSE Linux system and getting similar error:

/usr/lib64/gcc/x86_64-suse-linux/4.0.2/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/mysql/libmysqlclient.a(libmysql.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/libmysqlclient.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

This is the first time ever I am experiencing such an error. All 5.0.x versions of MySQL prior to 5.0.20 worked fine.
[12 Apr 2006 22:39] Andrei Nazarenko
One more thing (maybe related):

With MySQL 5.0.19 and lower I could install both 

MySQL-shared-5.0.19-0.glibc23.x86_64.rpm and
MySQL-shared-compat-5.0.19-0.glibc23.x86_64.rpm

at the same time.

With MySQL 5.0.20 i can only install one or the other.
I am getting an error about conflicting libraries if I try to have both installed at the same time.
[24 Apr 2006 13:00] Andrei Nazarenko
Still the same problem with 5.0.20a. Cannot compile PHP with MySQL support on 64bit Linux... :(
[25 Apr 2006 7:24] Andrei Nazarenko
When I have 5.0.20 X86_64 installed I can see now that the version of the libmysqlclient.a is reported back as 5.1.7 beta.

Before it was matching the release number, i.e. version 5.0.19, etc.

Is this intended?
[25 Apr 2006 8:46] Kent Boortz
While technically the "soname" of the 5.0 and 5.1 client
library is the same and they should be compatible, it
was not intended and filed as bug#19288.
[2 May 2006 14:57] Andrei Nazarenko
Still the same problem with 5.0.21 x86_64 Linux.
Compilation of PHP fails with the relocation error as before.
[4 May 2006 20:09] Andrei Nazarenko
Regarding this comment from Kent:

> As position independent code (PIC) is slower on some
> platforms we need to make sure only the client
> code is compiled with PIC flags. The client library is
> not performance critical in the same way as the server.

I believe it is a well known fact that on x86_64 (AMD64) platform the PIC code does not cause performance degradation. Can we at least have x86_64 binaries compiled with -fPIC flag in the next release please?
[8 May 2006 14:00] Marcel Kirsch
I totally agree with Andrei Nazarenko.
Please compile x86_64 rpms with this flag!
I don't want to spend my nights with rebuilding src-rpms,
because the original packages don't work
[24 May 2006 21:57] Wayne Walker
Please fix this.  The reason we use .rpm's from mysql is you recommend that we use your prebuilt binaries.  
Please.
[29 May 2006 18:46] Valeriy Kravchuk
Bug #19999 was marked as a duplicate of this one.
[6 Jun 2006 12:37] Kent Boortz
All binaries are compiled position independent in
4.1.20 and 5.0.22, and will be in 5.1.11 beta.
[9 Jun 2006 18:39] Paul DuBois
Noted in 4.1.20, 5.0.22, 5.1.11 changelogs.