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: mpeppler at itf dot ch (Michael Peppler)
Subject: Re: Static linking
Date: Feb 22 1996 7:06AM

> From: Tom Wilson <>
> I compiled sybperl2.0 into perl5.001m using static linking (CONFIG
> "LINKTYPE=static"). Yet when I ran the executable on another machine with the
> Sybase libraries in a different location, I got an error message that it
> couldn't find the Sybase shared libraries.  What else do I have to do to get
> static linking?

It depends on your compiler. With the bundled SunOS cc, you can put
-Bstatic before the libraries you wish to link statically, and then
revert to -Bdynamic. I don't know how to get the same features with gcc
(there is the -static flag, but I don't think that there is a
corresponding -dynamic flag to revert the rest of the libraries to
their default state (the reason this is necessary is that you have
probably built perl with dynamic loading of certain modules (such as
POSIX) and these modules may fail to load if the new binary with the
Sybase libs is linked in fully static mode).

[I hope the above makes sense ...]


There is a (relatively) easy solution:

If the linker can't find the .so or .sl files during linking, it will
use static linking for those libraries, so you could do it this way:

# Make a Sybase directory in your home directory to hold the libraries
# and include files.
mkdir ~/SYBASE
mkdir ~/SYBASE/lib
mkdir ~/SYBASE/include
# Copy the Sybase static libs to your new directory
cp $SYBASE/lib/*.a ~/SYBASE/lib
# Copy the include files
cp $SYBASE/include/*.h ~/SYBASE/include
[edit sybperl-2.0/CONFIG, and set SYBASE=/home/.../SYBASE]
[rebuild sybperl]

Et voila! :-)