You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Henri Gomez <he...@gmail.com> on 2006/03/08 13:04:28 UTC

How to make use APR 1.2.2 statically

Hi to all,

I'm using a Suse SLES 9 on a Linux Power PC box (an iSeries LPAR).

SLES 9 came with Apache 2.0.49 and APR 0.9.5 but to be able to use
Tomcat 5.5.x with APR support (tomcat-native), I should use an APR
1.1+.

I build apr 1.2.2 and installed it in /root/local/ and I wonder now
how I could make use of APR 1.2.2 statically ?

For example in tomcat-native 1.1.2, the makefile is :

$(TARGET_LIB): $(OBJECTS)
        $(LINK) -rpath $(libdir) $(OBJECTS)
/root/local/lib/libapr-1.la -lrt -lcrypt  -lpthread -ldl -lssl
-lcrypto


I tried with :

$(TARGET_LIB): $(OBJECTS)
        $(LINK) -rpath $(libdir) $(OBJECTS) -Bstatic
/root/local/lib/libapr-1.a -lrt -lcrypt  -lpthread -ldl -lssl -lcrypto


But it didn't works, got this :

/bin/sh /root/local/build-1/libtool --silent --mode=link  gcc -g -O2
-pthread   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D                  
    _GNU_SOURCE -D_LARGEFILE64_SOURCE   -g -O2 -DHAVE_OPENSSL
-DAPR_DECLARE_STATIC  -I/root/tomcat-native-1.1.2/jni/native/in       
               clude -I/opt/IBMJava2-cxppc32142ifx-20060209//include
-I/opt/IBMJava2-cxppc32142ifx-20060209//include/  -I/root/local/inc   
                   lude/apr-1   -version-info 2:2:2    -o
libtcnative-1.la -rpath /usr/local/apr/lib src/os.lo src/info.lo
src/poll.lo src/p                       ool.lo src/misc.lo
src/error.lo src/shm.lo src/proc.lo src/mmap.lo src/network.lo
src/sslcontext.lo src/dir.lo src/user.l                       o
src/sslnetwork.lo src/sslutils.lo src/ssl.lo src/file.lo
src/sslinfo.lo src/stdlib.lo src/lock.lo src/jnilib.lo os/unix        
              /uxpipe.lo os/unix/system.lo -Bstatic
/root/local/lib/libapr-1.a -lrt -lcrypt  -lpthread -ldl -lssl -lcrypto

*** Warning: Linking the shared library libtcnative-1.la against the
*** static library /root/local/lib/libapr-1.a is not portable!
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `apr_snprintf' has a R                      
_PPC_REL24 relocation, that means
'/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
-fPIC.
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `apr_snprintf' has a R                      
_PPC_REL24 relocation, that means
'/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
-fPIC.
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `apr_snprintf' has a R                      
_PPC_REL24 relocation, that means
'/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
-fPIC.
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `apr_palloc' has a R_P                      
PC_REL24 relocation, that means
'/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
-fPIC.
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `__moddi3' has a R_PPC                       _REL24
relocation, that means '/root/local/lib/libapr-1.a(apr_strings.o)' was
compiled without -fPIC.
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `__divdi3' has a R_PPC                       _REL24
relocation, that means '/root/local/lib/libapr-1.a(apr_strings.o)' was
compiled without -fPIC.
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `apr_palloc' has a R_P                      
PC_REL24 relocation, that means
'/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
-fPIC.
/usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
Error: The symbol `apr_palloc' has a R_P                      
PC_REL24 relocation, that means
'/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
-fPIC.

Any help is more than welcome

Re: How to make use APR 1.2.2 statically

Posted by Henri Gomez <he...@gmail.com>.
Thanks.

It seems to works also with ./configure --with-pic

2006/3/8, Joe Orton <jo...@redhat.com>:
> On Wed, Mar 08, 2006 at 01:04:28PM +0100, Henri Gomez wrote:
> > Hi to all,
> >
> > I'm using a Suse SLES 9 on a Linux Power PC box (an iSeries LPAR).
> >
> > SLES 9 came with Apache 2.0.49 and APR 0.9.5 but to be able to use
> > Tomcat 5.5.x with APR support (tomcat-native), I should use an APR
> > 1.1+.
> >
> > I build apr 1.2.2 and installed it in /root/local/ and I wonder now
> > how I could make use of APR 1.2.2 statically ?
>
> You need to build APR with -fPIC, like the errors say, so use e.g.:
>
> CFLAGS=-fPIC ./configure ...
>
> when you configure APR.
>
> > /usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
> > Error: The symbol `apr_snprintf' has a R
> > _PPC_REL24 relocation, that means
> > '/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
> > -fPIC.
>
>

Re: How to make use APR 1.2.2 statically

Posted by Joe Orton <jo...@redhat.com>.
On Wed, Mar 08, 2006 at 01:04:28PM +0100, Henri Gomez wrote:
> Hi to all,
> 
> I'm using a Suse SLES 9 on a Linux Power PC box (an iSeries LPAR).
> 
> SLES 9 came with Apache 2.0.49 and APR 0.9.5 but to be able to use
> Tomcat 5.5.x with APR support (tomcat-native), I should use an APR
> 1.1+.
> 
> I build apr 1.2.2 and installed it in /root/local/ and I wonder now
> how I could make use of APR 1.2.2 statically ?

You need to build APR with -fPIC, like the errors say, so use e.g.:

CFLAGS=-fPIC ./configure ...

when you configure APR.

> /usr/lib/gcc-lib/powerpc-suse-linux/3.3.3/../../../../powerpc-suse-linux/bin/ld:
> Error: The symbol `apr_snprintf' has a R                      
> _PPC_REL24 relocation, that means
> '/root/local/lib/libapr-1.a(apr_strings.o)' was compiled without
> -fPIC.