undefined symbol in _mysql.so

Alex Lai
2013-03-09
2013-03-09
  • Alex Lai
    Alex Lai
    2013-03-09

    Hi Gurus,
    I'm having trouble making my MySQL-python-1.2.4 work. I install the module using easy_install without errors:

    /usr/local/Python-2.7/bin/easy_install-2.7 MySQL-python-1.2.4

    When I tried to import the module, python gave the following errors:

    /usr/local/Python-2.7/bin/python2.7

    import MySQLdb
    Traceback (most recent call last):
    File "", line 1, in
    File "/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/MySQLdb/init.py", line 19, in
    import _mysql
    ImportError: /usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so: undefined symbol: __cxa_pure_virtual

    ldd on _mysql.so showed some function as undefined:

    ]# ldd -d -r /usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so
    undefined symbol: cxa_pure_virtual (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: _ZTVN10cxxabiv120si_class_type_infoE (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: _ZTVN10cxxabiv117class_type_infoE (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: _ZTVN10cxxabiv121vmi_class_type_infoE (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: gxx_personality_v0 (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: _ZdaPv (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: _Znwm (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: _ZdlPv (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    undefined symbol: _Znam (/usr/local/Python-2.7/lib/python2.7/site-packages/MySQL_python-1.2.4-py2.7-linux-x86_64.egg/_mysql.so)
    linux-vdso.so.1 => (0x00007fffa7fff000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f914c749000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f914c4c4000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f914c2bc000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f914c0b8000)
    libpython2.7.so.1.0 => /usr/local/Python-2.7/lib/libpython2.7.so.1.0 (0x00007f914bcda000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f914bac4000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f914b733000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003fb3e00000)
    libz.so.1 => /usr/local/Python-2.7/lib/libz.so.1 (0x00007f914b61e000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007f914b41b000)

    The mysql packages I installed are:
    [root@sdpvvrsp810 bin]# rpm -qa|grep -i mysql
    MySQL-shared-5.6.10-1.el6.x86_64
    MySQL-server-5.6.10-1.el6.x86_64
    MySQL-shared-compat-5.6.10-1.el6.x86_64
    MySQL-client-5.6.10-1.el6.x86_64
    MySQL-devel-5.6.10-1.el6.x86_64

    and here are information related to GCC:

    [root@sdpvvrsp810 python-modules]# gcc --version
    gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6)
    Copyright (C) 2010 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    [root@sdpvvrsp810 python-modules]# strings -a /usr/local/Python-2.7/bin/python2.7|grep GCC
    GCC: (GNU) 4.4.4 20100726 (Red Hat 4.4.4-13)
    GCC: (GNU) 4.4.5 20110214 (Red Hat 4.4.5-6)

    [root@sdpvvrsp810 python-modules]# strings -a /usr/sbin/mysqld|grep GCC|uniq
    Mutexes and rw_locks use GCC atomic builtins
    GCC_3.0
    GCC: (GNU) 4.4.4 20100726 (Red Hat 4.4.4-13)
    GCC: (GNU) 4.4.5 20110214 (Red Hat 4.4.5-6)
    _Unwind_Resume@@GCC_3.0

    Could anyone please guild me the right direction?

    Your input is highly appreciated!

    Alex