apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel May" <dan...@spryware.com>
Subject RE: 64-bit build errors
Date Mon, 02 Jan 2006 14:46:26 GMT
	I will try the CFLAGS="-fPIC" on the APR build. I was using it
on my library build.  Under 32-bit, I have been using:

 ./configure --disable-shared --enable-static  

With this, I am able to statically link in the APR libs to my shared
lib.  I did not need the "-fPIC" flag. I like this method because I can
distribute a single binary library rather than installing and building
APR on each machine I need my library on.  My target is limited to
RedHat Linux and Win32, so it makes deployment a bit easier.

Why is it generally a bad idea to link APR statically into a shared
library ?  What is the preferred method ?  With the static method, I can
precisely control the version of APR that my library uses.  The only
downside I see is my library is larger and my library footprint is
larger.  This is an acceptable tradeoff in my environment.


-----Original Message-----
From: Joe Orton [mailto:jorton@redhat.com] 
Sent: Monday, January 02, 2006 6:21 AM
To: Daniel May
Cc: dev@apr.apache.org
Subject: Re: 64-bit build errors

On Wed, Dec 28, 2005 at 07:17:46PM -0600, Daniel May wrote:
> I was able to successfully build APR on Red Hat EL 4.  I have a shared

> library I am trying to build that is linking in APR statically.  I get

> the following error:
> /usr/bin/ld: /usr/local/apr/lib/libapr-1.a(apr_strings.o): relocation
> R_X86_64_32 against `a local symbol' can not  be used when making a 
> shared object; recompile with -fPIC
> /usr/local/apr/lib/libapr-1.a: could not read symbols: Bad value
> If I link against the shared APR lib it works fine.  I included -fPIC 
> in my make, but it did not help.

You used -fPIC when building what, your library or APR?  If you want to
link APR statically into a shared library (though this is generally a
pretty bad idea), you need to build APR with -fPIC, e.g. using:

  CFLAGS="-fPIC" ./configure ..



View raw message