Menu

Problems building on Solaris

Help
2002-11-06
2012-09-19
  • Christian Hedin

    Christian Hedin - 2002-11-06

    Hi, trying to build MySQL-python for solaris but these messages:

    gcc -shared build/temp.solaris-2.8-sun4u-2.1/_mysql.o -L/opt4/local/mysql/lib -lmysqlclient -lz -o build/lib.solaris-2.8-sun4u-2.1/_mysql.so
    Text relocation remains                         referenced
        against symbol                  offset      in file
    <unknown>                           0x968       /opt4/local/mysql/lib/libmysqlclient.a(libmysql.o)
    <unknown>                           0x96c       /opt4/local/mysql/lib/libmysqlclient.a(libmysql.o)
    <unknown>                           0x970       /opt4/local/mysql/lib/libmysqlclient.a(libmysql.o)
    <unknown>                           0x974       /opt4/local/mysql/lib/libmysqlclient.a(libmysql.o)
    <unknown>                           0x978       /opt4/local/mysql/lib/libmysqlclient.a(libmysql.o)
    <unknown>                           0x97c       /opt4/local/mysql/lib/libmysqlclient.a(libmysql.o)
    <unknown>                           0x980       /opt4/local/mysql/lib/libmysqlclient.a(libmysql.o)

    ...and so on and so forh for a couple of hundred lines...

    Any suggestions?

     
    • Davide Baroncelli

      I do have the same problem: doing some search resulted in the following:
      (the python faq):
      3.36. relocations remain against allocatable but non-writable sections *
      This linker error occurs on Solaris if you attempt to build an extension module which incorporates position-dependent (non-PIC) code. A common source of problems is that a static library (.a file), such as libreadline.a or libcrypto.a is linked with the extension module. The error specifically occurs when using gcc as the compiler, but /usr/ccs/bin/ld as the linker.

      The following solutions and work-arounds are known:

      1. Rebuild the libraries (libreadline, libcrypto) with -fPIC (-KPIC if using the system compiler). This is recommended; all object files in a shared library should be position-independent.

      2. Statically link the extension module and its libraries into the Python interpreter, by editing Modules/Setup.

      3. Use GNU ld instead of /usr/ccs/bin/ld; GNU ld will accept non-PIC code in shared libraries (and mark the section writable)

      4. Pass -mimpure-text to GCC when linking the module. This will force gcc to not pass -z text to ld; in turn, ld will make all text sections writable.

      Options 3 and 4 are not recommended, since the ability to share code across processes is lost.

      So: does anyone know how to solve the problem, given this information?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.