openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] 64 bit libHalf - R_X86_64_32S _eLut and -fPIC questi


From: Ken McGaugh
Subject: Re: [Openexr-devel] 64 bit libHalf - R_X86_64_32S _eLut and -fPIC question
Date: Fri, 14 Mar 2008 09:37:03 +1100

On 14/03/2008, at 9:08 AM, Paul Miller wrote:
Bob Friesenhahn wrote:
On Thu, 13 Mar 2008, Paul Miller wrote:

Since fPIC is apparently *required* on x64 Linux, I was wondering why the configure script didn't automatically enable it for me. Is that a bug or a feature?
Normally PIC is used in shared libraries, and not in archive (.a) files. The only exception that I have heard of is AIX, which seems to use .a files as shared libraries. Perhaps you need to use --enable-shared to build shared libraries and use the shared libraries?

I didn't want to use shared libs because then I'd have a dependency problem and have to deal with -rpath and such. With all of my (non- system) dependencies built statically, I can basically plop my app (and its plugins) anywhere and it'll work without setting env vars, which is much nicer (I think).


You can still achieve that kind of portability while using shared libraries if you distribute the shared libraries with your app. All you have to do is tell the linker that the shared libraries are relative to the executable by using a combination of the "-z origin" linker option and using $ORIGIN in your rpath.

For example, I have an app whose executable lives in a directory

    myApp/bin/myApp

And there are a bunch of shared libraries in

    myApp/lib

I set the rpath on myApp to

    $ORIGIN/../lib

and pass "-z origin" to the linker to activate it. I've even distributed libstdc++ and libgcc_s with an app that way to reduce compiler version dependencies.

--Ken






reply via email to

[Prev in Thread] Current Thread [Next in Thread]