Bug #14202 libmysqlclient.a for Solaris-sparc not compiled with -fPIC
Submitted: 21 Oct 2005 9:16 Modified: 9 Jun 2006 18:38
Reporter: Gary Ashford Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Packaging Severity:S1 (Critical)
Version:5.0.15, 5.0.13rc OS:Solaris (Solaris sparc 32 bit)
Assigned to: Kent Boortz

[21 Oct 2005 9:16] Gary Ashford
It is not possible to link an application against libmysqlclient.a on Solaris-sparc 32-bit, the linker fails to resolve symbols. Several hundred errors are reported followed by;

ld: fatal: relocations remain against allocatable but non-writable sections

How to repeat:
Create a simple c plus plus application and attempt to link in libmysqlclient.a.

Suggested fix:
The lib needs to be compiled with the -fPIC option turned on. When I recompile the library from source and tweek the makefile, the resulting library links successfully. It looks like the configure script has an error which is preventing -fPIC going into the solaris makefiles.
[7 Nov 2005 9:17] Valerii Kravchuk
Thank you for a problem report. 

Yes, -fPIC flag is not included in the standard builds' options. One may check the logs on production@mysql.com. I was not able to find the log for Solaris 8, but for Solaris 10 on SPARC 32 bit it is surely not defined (see, for example, /data0/mysqldev/my/archive/mysql-5.0.15/Logs/sol10-sparc-a-5.0-standard.config):

configure:43507: running /bin/bash './configure' --prefix=/usr/local/mysql  '--prefix=/usr/local/mysql' '--localstatedir=/usr/local/mysql/data' '--libexecdir=/usr/local/mysql/bin' '--with-comment=MySQL Community Edition - Standard (GPL)' '--with-extra-charsets=complex' '--with-server-suffix=-standard' '--enable-thread-safe-client' '--enable-local-infile' '--with-named-z-libs=no' '--disable-shared'
 '--with-big-tables' '--with-readline' '--with-archive-storage-engine' '--with-innodb' 'CC=cc-5.0' 'CFLAGS=-xO3 -Xa -xstrconst -mt -D_FORTEC_ -xarch=v8 -xc99=none' 'CXXFLAGS=-xO3 -noex -mt -D_FORTEC_ -xarch=v8' 'CXX=CC' 'LDFLAGS=-xarch=v8'
CFLAGS='-O -DDBUG_OFF -xO3 -Xa -xstrconst -mt -D_FORTEC_ -xarch=v8 -xc99=none -DHAVE_RWLOCK_T' CXXFLAGS='-O3 -DDBUG_OFF -xO3 -noex -mt -D_FORTEC_ -xarch=v8 -DHAVE_RWLOCK_T' --cache-file=/dev/null --srcdir=.

and so on...
[6 Jun 2006 12:34] 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:38] Paul Dubois
Noted in 4.1.20, 5.0.22, 5.1.11 changelogs.