Brian De Pradine <[EMAIL PROTECTED]> writes:
>Hello,
>
>I am new to Solaris so I am hoping that someone will be able to help me. 
>I am trying to link my application to perl 5.8.0 using the following:

You seem to be building a shared library rather than an "application".

>
>g++ -shared -o /testpool/staf/rel/solaris/staf/retail/lib/libPLSTAF.so 
>-Wl,-Bsymbolic -DSTAF_OS_NAME_SOLARIS -g -D_REENTRANT 
>-DSTAF_GETHOSTBYNAME_R_5PARM  -fPIC -O -DNDEBUG 
>-DSTAF_SHARED_LIB_PREFIX=lib -DSTAF_SHARED_LIB_SUFFIX=.so -D_PTHREADS 
>-DSTAF_NATIVE_COMPILER  -I/testpool/staf/src/staf/lang/perl 
>-I/testpool/staf/src/staf/lang/perl/unix 
>-I/testpool/staf/src/staf/stafif/unix -I/testpool/staf/src/staf/stafif 
>-I/usr/local/perl -L/testpool/staf/rel/solaris/staf/retail/lib 
>/testpool/staf/obj/solaris/staf/retail/lang/perl/PLSTAF.o 
>/testpool/staf/obj/solaris/staf/retail/lang/perl/PLSTAFCommandParser.o 
>/testpool/staf/obj/solaris/staf/retail/lang/perl/STAFPerlService.o 
>-lpthread -lsocket -lSTAF    -L/usr/local/lib 
>/usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/auto/DynaLoader/DynaLoader
>.a -L/usr/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/CORE -lperl 
>-lsocket -lnsl -ldl -lm -lrt -lpthread -lc
>
>when I run this I get the following errors (last few lines included only):

It would have been good to have the headings for these:

>
>memcpy                              0x334c 
>/usr/local/lib/perl5/5.8.0/sun4-
>solaris-thread-multi/CORE/libperl.a(utf8.o)
>memcpy                              0x29e4 
>/usr/local/lib/perl5/5.8.0/sun4-
>solaris-thread-multi/CORE/libperl.a(perlio.o)
>/usr/local/lib/perl5/5.8.0/sun4-
>solaris-thread-multi/CORE/libperl.a(pp_sys.o)
>__floatdidf                         0x8d4c 
>/usr/local/lib/perl5/5.8.0/sun4-
>solaris-thread-multi/CORE/libperl.a(pp_sys.o)
>ld: fatal: relocations remain against allocatable but non-writable sections
>collect2: ld returned 1 exit status
>
>
>Can someone point me at what I am doing wrong?

Something in your link line has caused linker to insist that all code 
is position independant (Solaris does not usually care but is good 
practice to make loadable .so's position independant).
(This requirement is probably folded into g++'s -shared flag.)

Now when perl is built as normal executable with a non-shared libperl
it is NOT built with -fPIC. 

Quick fix is probably to build perl to have a shared libperl.
Your .so will then be linked against position independant libperl.so 

The other thing I am unsure about in your link is the -Wl,-Bsymbolic.
Once upon a time it was important that perl saw the calling program's
malloc() etc. and -Bsymbolic muddled that - but those issues may have 
been fixed, also if that is going to cause any problems it will be at run-rime 
not link time. 



-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/

Reply via email to