Solaris Weirdness with 2.1

Greg Ewing see at my.signature
Wed May 16 23:43:20 EDT 2001


Tom Loredo wrote:
> 
> I had the "Text relocation..." errors when compiling
> PIL 1.1.2.  They went away if I changed the shared library linking
> command from "gcc -shared" to "ld -G".  I'm not sure what the problem
> was there

The reason is that the offending file wasn't compiled
with the -fPIC option, which generates position-independent
code. Normally ld doesn't care much about that, since the
result still works, it's just a bit less efficient,
because the dynamic linker has to make a copy of the
text segment for each process that uses it.

It seems that "gcc -shared" invokes ld with an option
to complain about this. So, you can either use "ld -G"
as you say, or recompile the .c files with -fPIC.
The latter is preferable in the long run if you can
do it, since the resulting shared library will link
faster and take up less memory if several processes
are using it.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list