cURL / Mailing Lists / curl-library / Single Mail

curl-library

[Q] relocations remain against allocatable but non-writable sections and relocation error on Solaris/gcc

From: Miklos Nemeth <mnemeth_at_kfkisystems.com>
Date: Tue, 8 Jan 2002 23:49:20 -0800

I'm building a shared library for a scripting engine
using the great libcurl.
I had no significant problems on Linux and Win32, but
on Solaris ...
I'm using Solaris 7 (SunOS 5.7) with gcc2.95.3
and the systems ld-tool (Software Generation Utilities - Solaris/ELF (3.0))
I have to link libcurl and OpenSSL statically into my dynamic/shared library
(my.so).

Here is my link command:

ld -G -o my.so -z text my.o libssl.a libcrypto.a
curl/lib/.libs/libcurl.a -lsocket -lnsl

and I get this:

Text relocation remains referenced
    against symbol offset in file
<unknown> 0x48 lib/sol7/libcurl.a(escape.o)
<unknown> 0xcc lib/sol7/libcurl.a(escape.o)
Curl_initinfo 0x1240
lib/sol7/libcurl.a(transfer.o)
...
<unknown> 0x22c
lib/sol7/libcurl.a(http_chunks.o)
<unknown> 0x1e0
lib/sol7/libcurl.a(mprintf.o)
ld: fatal: relocations remain against allocatable but non-writable sections

I can get rid of these when I omit "-z text" but then I get a run-time
error:

 Runtime Error: ld.so.1: fatal: relocation error: file
   /export/home/miklos/prj/my.so: symbol SSL_new: referenced symbol not
found

I searched the web, and found that a reason of the problem may be that some
object files
are not compiled with -fPIC.

I compiled my.o with -fPIC.

What is the case with libcurl?
Is the libcurl.a in the lib/.libs directy made of the PIC objects?

Thanks a lot for your help in advance,

Miklos
Received on 2002-01-09