Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Alan Burlison <Alan dot Burlison at sun dot com>
Subject: Re: DBD::Sybase and Sybase::CTlib build problems w/ 5.8.1, Solaris, gcc 3.x
Date: Oct 20 2003 11:46PM

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 (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 
(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

contrast that with (say) the system X11 library:

dump -Lv /usr/lib/ | grep NEEDED
[2]     NEEDED
[4]     NEEDED
[6]     NEEDED
[8]     NEEDED
[9]     NEEDED

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, 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
[4]     NEEDED
[5]     NEEDED
$ dump -Lv /usr/perl5/5.8.1/lib/sun4-solaris-64int/CORE/ \
| grep NEEDED
[2]     NEEDED
[4]     NEEDED
[6]     NEEDED
[7]     NEEDED

as compared to 5.6.1

$ dump -Lv /usr/perl5/5.6.1/bin/perl | grep NEEDED
[1]     NEEDED
[2]     NEEDED
[3]     NEEDED
[4]     NEEDED
[5]     NEEDED
[6]     NEEDED
$ dump -Lv /usr/perl5/5.6.1/lib/sun4-solaris-64int/CORE/ | grep NEEDED
[1]     NEEDED
[2]     NEEDED
[3]     NEEDED
[4]     NEEDED
[5]     NEEDED

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 for 
building extensions?

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

Alan Burlison