Menu

Link Errors gcc 3.3 Solaris 7

Help
2003-07-09
2012-09-19
  • Jake Colman

    Jake Colman - 2003-07-09

    I am using gcc 3.3 on sparc-solaris-7 with Python 2.2.3 and mySql 4.0.13.  I am getting link errors when I try building MySqlDB.  Can anyone help?

     
    • Andy Dustman

      Andy Dustman - 2003-07-09

      Not without error messages.

       
      • Jake Colman

        Jake Colman - 2003-07-09

        Here is what I am getting:

        gcc -shared build/temp.solaris-2.7-sun4u-2.2/_mysql.o -L/homes/nj/colman/lib/mysql -Wl,-R/homes/nj/colman/lib:/homes/nj/colman/lib/mysql:/usr/local/lib:/usr/openwin/lib:/usr/dt/lib -lmysqlclient -lz -o build/lib.solaris-2.7-sun4u-2.2/_mysql.so
        Text relocation remains                     referenced
            against symbol            offset    in file
        <unknown>                           0x7bc         /homes/nj/colman/lib/mysql/libmysqlclient.a(libmysql.o)
        <unknown>                           0x7c0         /homes/nj/colman/lib/mysql/libmysqlcl
        ...
        ...
        ...
        ld: fatal: relocations remain against allocatable but non-writable sections
        collect2: ld returned 1 exit status
        error: command 'gcc' failed with exit status 1

         
    • Andy Dustman

      Andy Dustman - 2003-07-09

      You left out the compile line, so I can't tell if you are using -fPIC or not. setup.py does this:

      elif sys.platform == "sunos5": # Solaris 2.8 + gcc
          runtime_library_dirs.append('/usr/local/lib:/usr/openwin/lib:/usr/dt/lib')
          extra_compile_args.append("-fPIC")

      I seem to recally this flag was specifically for this problem. So, what is your value of sys.platform?

      Also please try MySQL-python-0.9.3a1.

       
    • Jake Colman

      Jake Colman - 2003-07-09

      Yes, I am using the -fPIC option and have tried this with both 0.9.2 and 0.9.3a1.

      I deleted the .o file so that I can show you the compile statement, the compile results and the linker output.

      building '_mysql' extension
      gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/homes/nj/colman/include/mysql -I/homes/nj/colman/include/python2.2 -c _mysql.c -o build/temp.solaris-2.7-sun4u-2.2/_mysql.o -fPIC
      _mysql.c: In function `_escape_item':
      _mysql.c:740: warning: dereferencing type-punned pointer will break strict-aliasing rules
      _mysql.c: In function `init_mysql':
      _mysql.c:2371: warning: dereferencing type-punned pointer will break strict-aliasing rules
      _mysql.c:2375: warning: dereferencing type-punned pointer will break strict-aliasing rules
      gcc -shared build/temp.solaris-2.7-sun4u-2.2/_mysql.o -L/homes/nj/colman/lib/mysql -Wl,-R/homes/nj/colman/lib:/homes/nj/colman/lib/mysql:/usr/local/lib:/usr/openwin/lib:/usr/dt/lib -lmysqlclient -lz -o build/lib.solaris-2.7-sun4u-2.2/_mysql.so
      Text relocation remains                     referenced
          against symbol            offset    in file
      <unknown>                           0x7bc         /homes/nj/colman/lib/mysql/libmysqlclient.a(libmysql.o)
      <unknown>                           0x7c0         /homes/nj/colman/lib/mysql/libmysqlcl

       
      • Andy Dustman

        Andy Dustman - 2003-07-10

        There are some casts to (PyObject *) on those lines. They are needed to above some other warnings on my setup, but perhaps you could try removing them to see what they do on yours. I expect they will only change the warnings.

         
    • Jake Colman

      Jake Colman - 2003-07-10

      Can anyone help me with the above problem?  Has anyone seen this problem before?  I'm behind the 8-ball here on a project I need to do that requires this package.  Any help would be greatly appreciated!

      Thanks!

      ...Jake

       
    • Jake Colman

      Jake Colman - 2003-07-10

      This results in new compiler warning but the same linker errors.

      _mysql.c: In function `_escape_item':
      _mysql.c:741: warning: passing arg 2 of `PyObject_GetItem' from incompatible pointer type
      _mysql.c: In function `init_mysql':
      _mysql.c:2373: warning: passing arg 3 of `PyDict_SetItemString' from incompatible pointer type
      _mysql.c:2378: warning: passing arg 3 of `PyDict_SetItemString' from incompatible pointer type

      So where do we go from here?

       
    • Andy Dustman

      Andy Dustman - 2003-07-10

      Read http://mail.gnu.org/archive/html/discuss-gnustep/2003-05/msg00418.html and try adding -fno-strict-aliasing to extra_compiler_flags in the Solaris portion of setup.py.

       
    • Jake Colman

      Jake Colman - 2003-07-10

      The warnings went away but the linker problems remain.

      BTW I edited "extra_compile_args.append" to include the compiler option and the build failed with an "unrecognized option" error.  I copied/pasted the gcc command-line and it compiled fine.  I then reexecuted 'python setup.py build' and it went straight to the link step and gave me the same errors as before.

       
      • Guy Middleton

        Guy Middleton - 2003-08-02

        I am having the same problem on Solaris 9.

        I found this reference http://aspn.activestate.com/ASPN/Mail/Message/python-dev/798432 
        which appears to describe the same problem.

        It looks like the solution is to use the GNU ld instead of the Solaris /usr/ccs/bin/ld.  Unfortunately I don't have an easy way of doing this on Solaris 9.

         
        • Jake Colman

          Jake Colman - 2003-08-05

          Bingo!  I downloaded gnu binutils and installed.  I reconfigured gcc to use gnu ld and gnu as, pointing it at the installed location of binutils.  I rebuilt gcc, python, and the mySqlDB extension and all is well!  Thanks!

           

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.