You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rasmus Lerdorf <ra...@lerdorf.on.ca> on 1998/05/25 14:00:33 UTC

Solaris 2.6 vs. Solaris 2.5.1 shared lib differences?

Can someone here shed some light on what has changed from Solaris 2.5.1 to
Solaris 2.6.0 with respect to shared libraries?  I have gcc-2.8.1 on two
machines, one running Solaris 2.5.1 and the other 2.6.0.  I compile Apache
(or any binary for that matter) statically with "-O2 -g" on both systems. 
Then I compile a shared library with "gcc -fpic" and link it with "gcc -G"
and dlopen() it from the static binary.  This works fine on Solaris 2.5.1
but fails on Solaris 2.6.0.  On 2.6.0 I get a relocation error and it is
unable to find the symbol.  If I go back and compile my statically linked
binary with -fpic on Solaris 2.6.0 then it suddenly works. 

It can't be right that I have to use -fpic on the code that is loading the
shared library, can it?  

The symbol it is unable to find is a function that my shared library is
trying to call back in the static binary/library.  Is there something I
can do in this function to make it visible to my shared libraries without
having to compile everything with -fpic?

-Rasmus


Re: Solaris 2.6 vs. Solaris 2.5.1 shared lib differences?

Posted by Dirk-Willem van Gulik <di...@jrc.it>.
On Mon, 25 May 1998, Rasmus Lerdorf wrote:

> Can someone here shed some light on what has changed from Solaris 2.5.1 to
> Solaris 2.6.0 with respect to shared libraries?  I have gcc-2.8.1 on two
> machines, one running Solaris 2.5.1 and the other 2.6.0.  I compile Apache
> (or any binary for that matter) statically with "-O2 -g" on both systems. 
> Then I compile a shared library with "gcc -fpic" and link it with "gcc -G"
> and dlopen() it from the static binary.  This works fine on Solaris 2.5.1
> but fails on Solaris 2.6.0.  On 2.6.0 I get a relocation error and it is
> unable to find the symbol.  If I go back and compile my statically linked
> binary with -fpic on Solaris 2.6.0 then it suddenly works. 
> 
> It can't be right that I have to use -fpic on the code that is loading the
> shared library, can it?  

Might well be. I've sene the same here. Hold on; I need to talk to a ldd
guru later today. 
 
> The symbol it is unable to find is a function that my shared library is
> trying to call back in the static binary/library.  Is there something I
> can do in this function to make it visible to my shared libraries without
> having to compile everything with -fpic?

Yes, that sounds like the correct summary.

DW