develooper Front page | perl.perl5.porters | Postings from October 2003

Re: DBD::Sybase and Sybase::CTlib build problems w/ 5.8.1, Solaris, gcc 3.x

Thread Next
From:
Alan Burlison
Date:
October 20, 2003 16:46
Subject:
Re: DBD::Sybase and Sybase::CTlib build problems w/ 5.8.1, Solaris, gcc 3.x
Message ID:
3F9473B9.5070200@sun.com
Michael Peppler wrote:

 > FYI DBD::Sybase and Sybase::CTlib fail at the "make test" stage on
 > Solaris (and possibly other platforms) with perl 5.8.1 and gcc 3.x.
 >
 > The problem is the default LDDLFLAGS configuration value that is used
 > with 5.8.1, which includes the following flags:
 > 	-z ignore -z lazyload -z combreloc
 >
 > For some reason these linker flags cause Sybase's -ltcl to NOT get
 > linked in to the .so file, with the result that DBD::Sybase and
 > Sybase::CTlib fail to load with relocation errors when trying to load
 > Sybase's libct.so (I've seen symbols "com_tds_maptoken" and
 > "dcl_result_drop" mentioned in the error message).

Confirmed, with the Sun C compilers.

The cause of the problem is the '-z ignore' option, which tells the linker 
to leave out any unreferenced files from the dependency list which is stored 
in the DBD::Sybase shared object.  The Sybase libraries which use libcomn.so 
(for example) don't have the correct dependency lists, and are relying on 
the DBD::Sybase .so file to pull in all the dependencies that they might 
need.  The DBD::Sybase .so doesn't refer itself to symbols from these 
libraries, and the '-z ignore' means they don't get recorded as 
dependencies, and don't therefore get loaded by the run-time linker.

This is definitely a Sybase bug - *all* libraries should contain the *full* 
list of required dependencies, the Sybase ones only appear to have 
dependencies against libsocket - not even libc is included!  If they don't 
have the correct dependency list you get this sort of issue, and all *sorts* 
of odd brokenness if you try using dlopen/dlclose on the libraries.

$ dump -Lv /share/sybase,v11.1.1b/5.x/lib/*.so | grep NEEDED | sort -u
[1]     NEEDED          libsocket.so.1

contrast that with (say) the system X11 library:

dump -Lv /usr/lib/libX11.so | grep NEEDED
[2]     NEEDED          libXext.so.0
[4]     NEEDED          libsocket.so.1
[6]     NEEDED          libnsl.so.1
[8]     NEEDED          libdl.so.1
[9]     NEEDED          libc.so.1

However, having said that this is Sybase brokenness, this still obviously 
needs a fix.  The reason I added '-z ignore' in the first place was to make 
perl load a little faster - when building perl we use the same set of 
libraries on the link line for both the perl executable and libperl.so, but 
they have different dependencies, this is for 5.8.1 on Solaris:

$ dump -Lv /usr/perl5/5.8.1/bin/perl | grep NEEDED
[2]     NEEDED          libperl.so
[4]     NEEDED          libdl.so.1
[5]     NEEDED          libc.so.1
$ dump -Lv /usr/perl5/5.8.1/lib/sun4-solaris-64int/CORE/libperl.so \
| grep NEEDED
[2]     NEEDED          libsocket.so.1
[4]     NEEDED          libnsl.so.1
[6]     NEEDED          libm.so.2
[7]     NEEDED          libc.so.1

as compared to 5.6.1

$ dump -Lv /usr/perl5/5.6.1/bin/perl | grep NEEDED
[1]     NEEDED          libperl.so.1
[2]     NEEDED          libsocket.so.1
[3]     NEEDED          libnsl.so.1
[4]     NEEDED          libdl.so.1
[5]     NEEDED          libm.so.2
[6]     NEEDED          libc.so.1
$ dump -Lv /usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE/libperl.so | grep NEEDED
[1]     NEEDED          libsocket.so.1
[2]     NEEDED          libnsl.so.1
[3]     NEEDED          libdl.so.1
[4]     NEEDED          libm.so.2
[5]     NEEDED          libc.so.1

By leaving out the required dependencies, and marking them as lazyload, we 
can speed up start-up slightly.  I'm loathe to throw this change away, but I 
suspect we may have to.  I'm wondering if it is possible to use one set of 
flags for building perl, and a different set for storing in Config.pm for 
building extensions?

As a short-term workaround, you can edit Config.pm and remove '-z ignore' 
from ccdlflags and lddlflags

-- 
Alan Burlison
--


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About