cURL / Mailing Lists / curl-library / Single Mail


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

From: Miklos Nemeth <>
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

Here is my link command:

ld -G -o -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
<unknown> 0x22c
<unknown> 0x1e0
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

 Runtime Error: fatal: relocation error: file
   /export/home/miklos/prj/ symbol SSL_new: referenced symbol not

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,

Received on 2002-01-09