Relocation error in build

During the building of php 5.3.6 in a CentOS 5.6 machine , I have relocation error on deflateInit2_ symbol :

/export/share/src/php-5.3.6/sapi/cli/php: relocation error: /export/share/src/php-5.3.6/sapi/cli/php: symbol deflateInit2_, version libmysqlclient_16 not defined in file libmysqlclient.so.16 with link time reference
make: *** [ext/phar/phar.phar] Error 127

Check the location for the shared library in question :

% ldd /export/share/src/php-5.3.6/sapi/cli/php | grep libmysqlclient
libmysqlclient.so.16 => /usr/lib64/libmysqlclient.so.16 (0x00002b4ff99cd000)

Get the exact shared library name :

% ls -al /usr/lib64/libmysqlclient.so.16
lrwxrwxrwx 1 root root 24 Mar 30 2011 /usr/lib64/libmysqlclient.so.16 -> libmysqlclient.so.16.0.0

Find all instances of this library :

% updatedb ; locate libmysqlclient.so.16.0.0
/usr/lib64/libmysqlclient.so.16.0.0
/usr/lib64/mysql/libmysqlclient.so.16.0.0
(Note: updatedb – update a database for mlocate
locate : locate – find files by name)

Now , search for the string “deflateInit2_” in these 2 shared libraries . However , don’t use the command “nm” which is supposed to list symbols from object files . “nm” will fail to return the symbol even it can search it . Now use the command “strings” instead .

% strings /usr/lib64/mysql/libmysqlclient.so.16.0.0 | grep deflateInit2_
deflateInit2_
% strings /usr/lib64/libmysqlclient.so.16.0.0 | grep deflateInit2_
%

So /usr/lib64/mysql/libmysqlclient.so.16.0.0 will contain the required symbol , hence replace /usr/lib64/libmysqlclient.so.16.0.0 with /usr/lib64/mysql/libmysqlclient.so.16.0.0 to fix the build problem .

Ref1 Ref2

You may also like...