Menu

Installing problem

Help
2006-06-29
2012-09-19
  • Davide Muzzarelli

    I have wasted 3 houres for this and I do not found a solution.

    My system: Slackware current, GCC 3.3.6, Python 2.4, MySQL 4.1.15.

    This is the error:
    $ python setup.py build
    running build
    running build_py
    copying MySQLdb/release.py -> build/lib.linux-i686-2.4/MySQLdb
    running build_ext
    building '_mysql' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mtune=i686 -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -march=i486 -mcpu=i686 -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
    cc1: error: invalid option `tune=i686'
    error: command 'gcc' failed with exit status 1

    The variable "ext_mysql_metadata" in setup.py contain:
    {'libraries': ['mysqlclient_r', 'z', 'pthread', 'crypt', 'nsl', 'm', 'pthread', 'ssl', 'crypto'], 'sources': ['_mysql.c'], 'name': '_mysql', 'extra_compile_args': ['-march=i486', '-mcpu=i686', '-Dversion_info="(1,2,1,\'final\',2)"', '-Dversion="1.2.1_p2"'], 'library_dirs': ['/usr/lib/mysql', '/usr/lib'], 'extra_objects': [], 'include_dirs': ['/usr/include/mysql']}

    No CFLAGs environment variables.

    How to solve this problem?

     
    • Davide Muzzarelli

      I have resolved editing the file /usr/lib/python/config/Makefile:

      Compiler options

      OPT= -DNDEBUG -O3 -march=i486 -mtune=i686
      ^^^^
      whith:

      Compiler options

      OPT= -DNDEBUG -O3 -march=i486 -mcpu=i686

      Byez!


      By Davide "Design" Muzzarelli

       
    • Andy Dustman

      Andy Dustman - 2006-06-29

      Check the output of mysql_config. I think your MySQL (or Python) may be built with a newer version of GCC than is being used on your system. -mtune is in gcc-3.4 but with gcc-3.3 and earlier, -mcpu should be used. -mcpu=i686 is in there, and it may be from either mysql_config or Python's build environment (look at /usr/lib/python2.4/config/Makefile and search for CFLAGS).

      http://gcc.gnu.org/gcc-3.4/changes.html

       
    • Davide Muzzarelli

      $ mysql_config
      Usage: /usr/bin/mysql_config [OPTIONS]
      Options:
      --cflags [-I/usr/include/mysql -march=i486 -mcpu=i686]
      --include [-I/usr/include/mysql]
      --libs [-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto]
      --libs_r [-L/usr/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto]
      --socket [/var/run/mysql/mysql.sock]
      --port [3306]
      --version [4.1.15]
      --libmysqld-libs [-L/usr/lib/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]

      Thanks, now I have compiled manually to bypass the problem and there is another error:
      $ gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -march=i486 -mcpu=i686 -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
      _mysql.c:2804:45: warning: character constant too long for its type
      _mysql.c: In function init_mysql': _mysql.c:2805: warning: passing arg 1 ofPyRun_String' makes pointer from integer without a cast
      _mysql.c:2808:52: too many decimal points in number

       
      • Andy Dustman

        Andy Dustman - 2006-06-29

        Escape those double-quotes (") with backslashes when doing that from the shell.

         
        • Davide Muzzarelli

          I have tested a lot of variantes:
          -Dversion_info="(1,2,1,\"final\",2)"
          -Dversion_info="(1,2,1,\'final\',2)"
          -Dversion_info=\"(1,2,1,'final',2)\"
          -Dversion_info='(1,2,1,"final",2)'
          -Dversion_info='(1,2,1,\"final\",2)'
          -Dversion_info=\'(1,2,1,"final",2)\'
          -Dversion_info='(1,2,1,\'final\',2)'
          -Dversion_info="(121)"
          ecc...

          ...but the problem remain.

           
        • Davide Muzzarelli

          What double-quotes?

          $ gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -march=i486 -mcpu=i686 -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"

          Quotes (single and double) in -Dversion_info="(1,2,1,'final',2)" and -Dversion="1.2.1_p2" are correct...

           

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.