Installing Python problems (_socket.so)

"Martin v. Löwis" martin at v.loewis.de
Sun Jan 12 16:24:00 EST 2003


Sam Carleton wrote:
> ld: fatal: relocations remain against allocatable but non-writable
> sections
[...]
> There does not seem to be much info here.  Is there any way I can get
> more info as to solve the problem?

That is the problem: You are linking a shared library, but some of your 
code (the OpenSSL code) is position-dependent, when it should be 
position-independent (PIC).

You have the following options:
1. Accept the failure; your Python installation won't support sockets.
2. Build the socket module without SSL support. To do so, edit
    Modules/Setup.
3. Rebuilt OpenSSL for position-independent code. To do so, either
    a) build openssl with --enable-shared, and link the socket module
       with the shared library, or
    b) manually add -fPIC/-KPIC when building OpenSSL. This will still
       give a static library, but it will be PIC.
4. Work around the failure, by telling the linker that it is ok to
    incorporate PIC code to a shared library. To do so, either
    a) Use the system compiler (SunPRO/Forte/SunONE)) instead of
       gcc, or
    b) Use gnu binutils instead of the system linker, or
    c) Manually add -mimpure-text to the C compiler flags for linking.

If you want to know why a certain alternative solves this problem, just 
ask. There are a few options that also appear to solve the problem but 
don't, namely

4 d) Use the system linker instead of gcc for linking
   e) Use -G instead of -shared for linking

HTH,
Martin






More information about the Python-list mailing list