File "/usr/local/viewvc-1.0.0/lib/viewvc.py", line 3611, in main
request.run_viewvc()
File "/usr/local/viewvc-1.0.0/lib/viewvc.py", line 388, in run_viewvc
self.view_func(self)
File "/usr/local/viewvc-1.0.0/lib/viewvc.py", line 3331, in view_query
import cvsdb
File "/usr/local/viewvc-1.0.0/lib/cvsdb.py", line 20, in ?
import dbi
File "/usr/local/viewvc-1.0.0/lib/dbi.py", line 18, in ?
import MySQLdb
File "/usr/local/lib/python2.4/site-packages/MySQLdb/init.py", line 19, in ?
import _mysql
ImportError: /usr/local/lib/python2.4/site-packages/_mysql.so: undefined symbol: __pure_virtual
When I try to follow ViewVC INSTALL intructions for SQL CHECKIN DATABASE.
I installed MySQL-5.0.22 and MySQLdb(MySQL-Python-1.2.1-p2).
I created MySQL user, executed make-database script, edited the cvsbd section in viewvc.conf file.
I have Subversion 1.3.1 and viewvc 1.3.1 and Python 2.4.3, Swig 1.3.25 on Red Hat Linux Advanced Server 3.0.
Now when I execute the command "./svndbadmin rebuild /home/svn", I get the error above.
Any help would be truly appreciated.
Thanks,
Parag
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for replying. I removed the build directory and tried again but still getting same error. I'm not using RPM packages of MySQL. My execution steps and log is as follows:
I am having the same problem. How do I go about linking to libgcc? Let's pretend I'm somewhat noobish when it comes to that.
I am trying to build the same MySQLdb version (MySQL-Python-1.2.1-p2) as the original poster, against a MySQL 5.0.22 RPM distro, with the devel RPM included. I am using Python 2.3, if that makes any difference (unlikely). It is all on Red Hat Enterprise Linux 4 (pretty certain).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That didn't seem to do anything. If there is a compiler mismatch, my hands are tied, I am incapable of resolving that issue on that machine. I have gcc-3.4 available on the system, and don't know of any way to verify the compiler mismatch -- I'm guessing that MySQL was built with a completely different compiler (like the IBM one), since I am using the pre-built RPM binaries (and am not authorized to compile it from source).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should install the "Linux x86 generic RPM (dynamically linked)" distribution instead of the "Linux x86 generic RPM (statically linked against glibc 2.2.5)" version.
Jim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm going to try to install a "build" environment, where I might be able to construct an RPM which I then can install on the server in question, which will hopefully then make this all work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I do 'python setup.py install' I get following log. At the end of it there is an error. Does that help to detect the problem?
I'm using gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-53)
_mysql.c:1635: warning: passing arg 1 of PyString_FromString' makes pointer from integer without a cast
_mysql.c: At top level:
_mysql.c:1646: syntax error before '*' token
_mysql.c:1648: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ConnectionObject_info':
_mysql.c:1650: args' undeclared (first use in this function)
_mysql.c:1651:self' undeclared (first use in this function)
_mysql.c:1652: warning: implicit declaration of function mysql_info'
_mysql.c:1652: warning: assignment makes pointer from integer without a cast
_mysql.c: At top level:
_mysql.c:1681: syntax error before '*' token
_mysql.c:1683: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ConnectionObject_insert_id':
_mysql.c:1684: my_ulonglong' undeclared (first use in this function)
_mysql.c:1684: syntax error before "r"
_mysql.c:1685:args' undeclared (first use in this function)
_mysql.c:1686: self' undeclared (first use in this function)
_mysql.c:1688:r' undeclared (first use in this function)
_mysql.c:1688: warning: implicit declaration of function mysql_insert_id'
_mysql.c: At top level:
_mysql.c:1699: syntax error before '*' token
_mysql.c:1701: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ConnectionObject_kill':
_mysql.c:1704: args' undeclared (first use in this function)
_mysql.c:1705:self' undeclared (first use in this function)
_mysql.c:1707: warning: implicit declaration of function mysql_kill'
_mysql.c: At top level:
_mysql.c:1722: syntax error before '*' token
_mysql.c:1724: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ConnectionObject_field_count':
_mysql.c:1725: args' undeclared (first use in this function)
_mysql.c:1726:self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1739: syntax error before '' token
_mysql.c:1741: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ResultObject_num_fields':
_mysql.c:1742:args' undeclared (first use in this function)
_mysql.c:1743: syntax error before ')' token
_mysql.c:1743: syntax error before ')' token
_mysql.c:1744: self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1755: syntax error before '*' token
_mysql.c:1757: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ResultObject_num_rows':
_mysql.c:1758: args' undeclared (first use in this function)
_mysql.c:1759: syntax error before ')' token
_mysql.c:1759: syntax error before ')' token
_mysql.c:1760:self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:1777: syntax error before '' token
_mysql.c:1779: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_ping':
_mysql.c:1781:args' undeclared (first use in this function)
_mysql.c:1782: self' undeclared (first use in this function)
_mysql.c:1784: warning: implicit declaration of functionmysql_ping'
_mysql.c: At top level:
_mysql.c:1799: syntax error before '' token
_mysql.c:1801: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_query':
_mysql.c:1804:args' undeclared (first use in this function)
_mysql.c:1805: self' undeclared (first use in this function)
_mysql.c:1807: warning: implicit declaration of functionmysql_real_query'
_mysql.c: At top level:
_mysql.c:1829: syntax error before '' token
_mysql.c:1831: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_select_db':
_mysql.c:1834:args' undeclared (first use in this function)
_mysql.c:1835: self' undeclared (first use in this function)
_mysql.c:1837: warning: implicit declaration of functionmysql_select_db'
_mysql.c: At top level:
_mysql.c:1851: syntax error before '' token
_mysql.c:1853: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_shutdown':
_mysql.c:1855:args' undeclared (first use in this function)
_mysql.c:1856: self' undeclared (first use in this function)
_mysql.c:1858: warning: implicit declaration of functionmysql_shutdown'
_mysql.c: At top level:
_mysql.c:1878: syntax error before '' token
_mysql.c:1880: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_stat':
_mysql.c:1882:args' undeclared (first use in this function)
_mysql.c:1883: self' undeclared (first use in this function)
_mysql.c:1885: warning: implicit declaration of functionmysql_stat'
_mysql.c:1885: warning: assignment makes pointer from integer without a cast
_mysql.c: At top level:
_mysql.c:1899: syntax error before '' token
_mysql.c:1901: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_store_result':
_mysql.c:1903:r' undeclared (first use in this function)
_mysql.c:1905: args' undeclared (first use in this function)
_mysql.c:1906:self' undeclared (first use in this function)
_mysql.c:1911: syntax error before ')' token
_mysql.c: At top level:
_mysql.c:1940: syntax error before '' token
_mysql.c:1942: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_thread_id':
_mysql.c:1944:args' undeclared (first use in this function)
_mysql.c:1945: self' undeclared (first use in this function)
_mysql.c:1947: warning: implicit declaration of functionmysql_thread_id'
_mysql.c: At top level:
_mysql.c:1960: syntax error before '' token
_mysql.c:1962: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_use_result':
_mysql.c:1964:r' undeclared (first use in this function)
_mysql.c:1966: args' undeclared (first use in this function)
_mysql.c:1967:self' undeclared (first use in this function)
_mysql.c:1972: syntax error before ')' token
_mysql.c: At top level:
_mysql.c:1990: syntax error before '' token
_mysql.c:1991: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_dealloc':
_mysql.c:1994:self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2004: syntax error before '' token
_mysql.c:2005: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ConnectionObject_repr':
_mysql.c:2007:self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2021: syntax error before '' token
_mysql.c:2023: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ResultObject_data_seek':
_mysql.c:2025:args' undeclared (first use in this function)
_mysql.c:2026: syntax error before ')' token
_mysql.c:2026: syntax error before ')' token
_mysql.c:2027: warning: implicit declaration of function mysql_data_seek'
_mysql.c:2027:self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2036: syntax error before '' token
_mysql.c:2038: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ResultObject_row_seek':
_mysql.c:2040:MYSQL_ROW_OFFSET' undeclared (first use in this function)
_mysql.c:2040: syntax error before "r"
_mysql.c:2041: args' undeclared (first use in this function)
_mysql.c:2042: syntax error before ')' token
_mysql.c:2042: syntax error before ')' token
_mysql.c:2043:self' undeclared (first use in this function)
_mysql.c:2048: r' undeclared (first use in this function)
_mysql.c:2048: warning: implicit declaration of functionmysql_row_tell'
_mysql.c:2049: warning: implicit declaration of function mysql_row_seek'
_mysql.c: At top level:
_mysql.c:2058: syntax error before '*' token
_mysql.c:2060: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ResultObject_row_tell':
_mysql.c:2061: MYSQL_ROW_OFFSET' undeclared (first use in this function)
_mysql.c:2061: syntax error before "r"
_mysql.c:2062:args' undeclared (first use in this function)
_mysql.c:2063: syntax error before ')' token
_mysql.c:2063: syntax error before ')' token
_mysql.c:2064: self' undeclared (first use in this function)
_mysql.c:2069:r' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2075: syntax error before '' token
_mysql.c:2076: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ResultObject_dealloc':
_mysql.c:2077:self' undeclared (first use in this function)
_mysql.c:2078: warning: implicit declaration of function mysql_free_result'
_mysql.c: At top level:
_mysql.c:2085: syntax error before '*' token
_mysql.c:2086: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ResultObject_repr':
_mysql.c:2089: self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2315: syntax error before ')' token
_mysql.c:2315: initializer element is not constant
_mysql.c:2315: (near initialization for_mysql_ConnectionObject_memberlist[0].offset')
_mysql.c:2315: initializer element is not constant
_mysql.c:2315: (near initialization for _mysql_ConnectionObject_memberlist[0]')
_mysql.c:2322: syntax error before ')' token
_mysql.c:2322: initializer element is not constant
_mysql.c:2322: (near initialization for_mysql_ConnectionObject_memberlist[1].offset')
_mysql.c:2322: initializer element is not constant
_mysql.c:2322: (near initialization for _mysql_ConnectionObject_memberlist[1]')
_mysql.c:2329: syntax error before ')' token
_mysql.c:2329: initializer element is not constant
_mysql.c:2329: (near initialization for_mysql_ConnectionObject_memberlist[2].offset')
_mysql.c:2329: initializer element is not constant
_mysql.c:2329: (near initialization for _mysql_ConnectionObject_memberlist[2]')
_mysql.c:2336: syntax error before ')' token
_mysql.c:2336: initializer element is not constant
_mysql.c:2336: (near initialization for_mysql_ConnectionObject_memberlist[3].offset')
_mysql.c:2336: initializer element is not constant
_mysql.c:2336: (near initialization for _mysql_ConnectionObject_memberlist[3]')
_mysql.c:2343: syntax error before ')' token
_mysql.c:2343: initializer element is not constant
_mysql.c:2343: (near initialization for_mysql_ConnectionObject_memberlist[4].flags')
_mysql.c:2343: initializer element is not constant
_mysql.c:2343: (near initialization for _mysql_ConnectionObject_memberlist[4]')
_mysql.c:2344: initializer element is not constant
_mysql.c:2344: (near initialization for_mysql_ConnectionObject_memberlist[5]')
_mysql.c:2406: syntax error before ')' token
_mysql.c:2406: initializer element is not constant
_mysql.c:2406: (near initialization for _mysql_ResultObject_memberlist[0].offset')
_mysql.c:2406: initializer element is not constant
_mysql.c:2406: (near initialization for_mysql_ResultObject_memberlist[0]')
_mysql.c:2407: initializer element is not constant
_mysql.c:2407: (near initialization for _mysql_ResultObject_memberlist[1]')
_mysql.c:2412: syntax error before '*' token
_mysql.c:2414: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ConnectionObject_getattr':
_mysql.c:2417: self' undeclared (first use in this function)
_mysql.c:2417:name' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2440: syntax error before '*' token
_mysql.c:2442: warning: function declaration isn't a prototype
_mysql.c: In function _mysql_ResultObject_getattr':
_mysql.c:2445:self' undeclared (first use in this function)
_mysql.c:2445: name' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2466: syntax error before '*' token
_mysql.c:2469: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ConnectionObject_setattr':
_mysql.c:2470: v' undeclared (first use in this function)
_mysql.c:2481:name' undeclared (first use in this function)
_mysql.c:2482: self' undeclared (first use in this function)
_mysql.c: At top level:
_mysql.c:2491: syntax error before '*' token
_mysql.c:2494: warning: function declaration isn't a prototype
_mysql.c: In function_mysql_ResultObject_setattr':
_mysql.c:2495: v' undeclared (first use in this function)
_mysql.c:2506:name' undeclared (first use in this function)
_mysql.c:2507: `self' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am experiencing this error too. I have this error whenever I try to import MySQLdb:
[root@homepc MySQL-python-1.2.2]# python
Python 2.5 (r25:51908, Mar 13 2007, 14:22:25) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-linux-i686.egg/_mysql.pyc, but /usr/src/MySQL-python-1.2.2 is being added to sys.path
import sys, pkg_resources, imp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "MySQLdb/init.py", line 19, in <module>
import _mysql
File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module>
File "build/bdist.linux-i686/egg/_mysql.py", line 6, in bootstrap
ImportError: /root/.python-eggs/MySQL_python-1.2.2-py2.5-linux-i686.egg-tmp/_mysql.so: undefined symbol: __pure_virtual
I didnt encounter any errors while I was installing MySQLdb but only when I try to import it. I have MySQL 5.0 compiled from source and python 2.5 also from source.
[root@homepc MySQL-python-1.2.2]# mysql -V
mysql Ver 14.12 Distrib 5.0.27, for pc-linux-gnu (i686) using readline 5.0 [root@homepc MySQL-python-1.2.2]# python -V
Python 2.5
Before I installed xlrd but I didnt have problems with it.
Anything that I missed?
TIA.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have some sort of compiler mismatch (incompatible APIs). Is your Python-2.5 seriously compiled with gcc-3.2.3? Did you build it yourself? Did you build MySQL yourself? Unless MySQl and Python (and _mysql.so) are all built with compatible compiler ABIs (typically these have changed between major GCC versions, particularly 3.2 through 4.1), you will have problems like this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having exactly the same trouble (undefined symbol: __pure_virtual on import of MySQLdb built from source) - my hands are a bit tied because I'm merely a user of my university's web resources, and I must work with what's provided. The server is Red Hat Linux, i686 architecture from what I can gather.
It appears that mysql and python were compiled using different versions of GCC (I think that mysql is a prebuilt binary from the mysql site):
% strings -a /usr/local/bin/python2.4 | grep -i gcc | uniq -d
GCC: (GNU) 3.2.3 20030502 (Red Hat Linux 3.2.3-46)
% gcc --version
gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-58)
% mysql --version
mysql Ver 14.12 Distrib 5.0.27, for pc-linux-gnu (i686) using readline 5.0
% strings -a mysql | grep -i gcc | uniq -d
GCC: (GNU) 2.95.3 20010315 (SuSE)
So is there anything I can do to get a functioning version of MySQLdb on this machine? I can compile from source, but only gcc 3.2.3 is installed on the system. I'm getting a bit desperate because the system maintainers are about to switch to this architecture, and I have much software using this module running on the current (AIX) system (I'm trying this out in a development environment that they provide).
Thanks for any ideas.
Noah
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Something I left out: when I tried to compile MySQLdb using my new build of mysql, installation failed with an error that mysqlclient_r couldn't be found. I noticed that there was a mysqlclient_r.a in the lib directory of the binary distribution of mysql that I had installed previously - I copied this to lib/mysql in my newly compiled installation, and then MySQLdb compiled without errors.
Was this an error? I guess this may be reportable as a separate issue: it appears that MySQLdb requires components that are not included in recent source distributions of mysql (unless I've caused this problem with my selection of compile parameters).
Thanks again...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I get the following error:
File "/usr/local/viewvc-1.0.0/lib/viewvc.py", line 3611, in main
request.run_viewvc()
File "/usr/local/viewvc-1.0.0/lib/viewvc.py", line 388, in run_viewvc
self.view_func(self)
File "/usr/local/viewvc-1.0.0/lib/viewvc.py", line 3331, in view_query
import cvsdb
File "/usr/local/viewvc-1.0.0/lib/cvsdb.py", line 20, in ?
import dbi
File "/usr/local/viewvc-1.0.0/lib/dbi.py", line 18, in ?
import MySQLdb
File "/usr/local/lib/python2.4/site-packages/MySQLdb/init.py", line 19, in ?
import _mysql
ImportError: /usr/local/lib/python2.4/site-packages/_mysql.so: undefined symbol: __pure_virtual
When I try to follow ViewVC INSTALL intructions for SQL CHECKIN DATABASE.
I installed MySQL-5.0.22 and MySQLdb(MySQL-Python-1.2.1-p2).
I created MySQL user, executed make-database script, edited the cvsbd section in viewvc.conf file.
I have Subversion 1.3.1 and viewvc 1.3.1 and Python 2.4.3, Swig 1.3.25 on Red Hat Linux Advanced Server 3.0.
Now when I execute the command "./svndbadmin rebuild /home/svn", I get the error above.
Any help would be truly appreciated.
Thanks,
Parag
this question is mysql client lib problem.
you can recompile the mysql 5.1 rc in another dir (for example mysql4 in /usr/local/mysql/), recompile the mysql in /usr/local/mysql5/.
please change the setup_posix.py in line 26
change mysql_config.path='/usr/local/mysql5/bin/mysql_config' where is mysql_config is the mysql 5 's mysql_config .
Subversion and viewvc and swig are irrelevant.
Get rid of your build directory in your MySQL-python sources and try again and look for any compiler errors or warnings.
Are you using RPM packages of MySQL? If so, you need the -devel package as well to build MySQLdb.
Thanks for replying. I removed the build directory and tried again but still getting same error. I'm not using RPM packages of MySQL. My execution steps and log is as follows:
[root@localhost MySQL-python-1.2.1_p2]# python setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.4
copying _mysql_exceptions.py -> build/lib.linux-i686-2.4
creating build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/init.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-i686-2.4/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-i686-2.4/MySQLdb
creating build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-i686-2.4/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-i686-2.4/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.4
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/mysql/include -I/usr/local/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -mcpu=pentiumpro -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
gcc -pthread -shared build/temp.linux-i686-2.4/_mysql.o -L/usr/local/lib -L/usr/local/mysql/lib -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv -o build/lib.linux-i686-2.4/_mysql.so
[root@localhost MySQL-python-1.2.1_p2]# python setup.py install
running install
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.4/MySQLdb
running build_ext
running install_lib
copying build/lib.linux-i686-2.4/MySQLdb/release.py -> /usr/local/lib/python2.4/site-packages/MySQLdb
copying build/lib.linux-i686-2.4/_mysql.so -> /usr/local/lib/python2.4/site-packages
byte-compiling /usr/local/lib/python2.4/site-packages/MySQLdb/release.py to release.pyc
[root@localhost MySQL-python-1.2.1_p2]# cd /usr/local/viewvc-1.0.0/bin
[root@localhost bin]# ./svndbadmin rebuild /usr/local/src/repos/test
Traceback (most recent call last):
File "./svndbadmin", line 67, in ?
import cvsdb
File "/usr/local/viewvc-1.0.0/lib/cvsdb.py", line 20, in ?
import dbi
File "/usr/local/viewvc-1.0.0/lib/dbi.py", line 18, in ?
import MySQLdb
File "/usr/local/lib/python2.4/site-packages/MySQLdb/init.py", line 19, in ?
import _mysql
ImportError: /usr/local/lib/python2.4/site-packages/_mysql.so: undefined symbol: __pure_virtual
A Google search for __pure_virtual suggests that you may have link against libgcc for some reason.
http://gcc.gnu.org/ml/gcc-help/2001-08/msg00000.html
Are you using the same version of gcc to compile everything?
I am having the same problem. How do I go about linking to libgcc? Let's pretend I'm somewhat noobish when it comes to that.
I am trying to build the same MySQLdb version (MySQL-Python-1.2.1-p2) as the original poster, against a MySQL 5.0.22 RPM distro, with the devel RPM included. I am using Python 2.3, if that makes any difference (unlikely). It is all on Red Hat Enterprise Linux 4 (pretty certain).
Edit site.cfg. You'll need something like this:
[compiler]
libraries: gcc
Other libraries indicated by the output of mysql_config --libs will probably need to be added to this like (remove the -l prefixes).
As in the previous case, I think this is a compiler mismatch (gcc-3.3 vs. 3.4).
That didn't seem to do anything. If there is a compiler mismatch, my hands are tied, I am incapable of resolving that issue on that machine. I have gcc-3.4 available on the system, and don't know of any way to verify the compiler mismatch -- I'm guessing that MySQL was built with a completely different compiler (like the IBM one), since I am using the pre-built RPM binaries (and am not authorized to compile it from source).
You should install the "Linux x86 generic RPM (dynamically linked)" distribution instead of the "Linux x86 generic RPM (statically linked against glibc 2.2.5)" version.
Jim
I'm going to try to install a "build" environment, where I might be able to construct an RPM which I then can install on the server in question, which will hopefully then make this all work.
When I do 'python setup.py install' I get following log. At the end of it there is an error. Does that help to detect the problem?
I'm using gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-53)
_mysql.c:1635: warning: passing arg 1 of
PyString_FromString' makes pointer from integer without a cast _mysql.c: At top level: _mysql.c:1646: syntax error before '*' token _mysql.c:1648: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ConnectionObject_info':_mysql.c:1650:
args' undeclared (first use in this function) _mysql.c:1651:
self' undeclared (first use in this function)_mysql.c:1652: warning: implicit declaration of function
mysql_info' _mysql.c:1652: warning: assignment makes pointer from integer without a cast _mysql.c: At top level: _mysql.c:1681: syntax error before '*' token _mysql.c:1683: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ConnectionObject_insert_id':_mysql.c:1684:
my_ulonglong' undeclared (first use in this function) _mysql.c:1684: syntax error before "r" _mysql.c:1685:
args' undeclared (first use in this function)_mysql.c:1686:
self' undeclared (first use in this function) _mysql.c:1688:
r' undeclared (first use in this function)_mysql.c:1688: warning: implicit declaration of function
mysql_insert_id' _mysql.c: At top level: _mysql.c:1699: syntax error before '*' token _mysql.c:1701: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ConnectionObject_kill':_mysql.c:1704:
args' undeclared (first use in this function) _mysql.c:1705:
self' undeclared (first use in this function)_mysql.c:1707: warning: implicit declaration of function
mysql_kill' _mysql.c: At top level: _mysql.c:1722: syntax error before '*' token _mysql.c:1724: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ConnectionObject_field_count':_mysql.c:1725:
args' undeclared (first use in this function) _mysql.c:1726:
self' undeclared (first use in this function)_mysql.c: At top level:
_mysql.c:1739: syntax error before '' token
_mysql.c:1741: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ResultObject_num_fields': _mysql.c:1742:
args' undeclared (first use in this function)_mysql.c:1743: syntax error before ')' token
_mysql.c:1743: syntax error before ')' token
_mysql.c:1744:
self' undeclared (first use in this function) _mysql.c: At top level: _mysql.c:1755: syntax error before '*' token _mysql.c:1757: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ResultObject_num_rows':_mysql.c:1758:
args' undeclared (first use in this function) _mysql.c:1759: syntax error before ')' token _mysql.c:1759: syntax error before ')' token _mysql.c:1760:
self' undeclared (first use in this function)_mysql.c: At top level:
_mysql.c:1777: syntax error before '' token
_mysql.c:1779: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_ping': _mysql.c:1781:
args' undeclared (first use in this function)_mysql.c:1782:
self' undeclared (first use in this function) _mysql.c:1784: warning: implicit declaration of function
mysql_ping'_mysql.c: At top level:
_mysql.c:1799: syntax error before '' token
_mysql.c:1801: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_query': _mysql.c:1804:
args' undeclared (first use in this function)_mysql.c:1805:
self' undeclared (first use in this function) _mysql.c:1807: warning: implicit declaration of function
mysql_real_query'_mysql.c: At top level:
_mysql.c:1829: syntax error before '' token
_mysql.c:1831: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_select_db': _mysql.c:1834:
args' undeclared (first use in this function)_mysql.c:1835:
self' undeclared (first use in this function) _mysql.c:1837: warning: implicit declaration of function
mysql_select_db'_mysql.c: At top level:
_mysql.c:1851: syntax error before '' token
_mysql.c:1853: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_shutdown': _mysql.c:1855:
args' undeclared (first use in this function)_mysql.c:1856:
self' undeclared (first use in this function) _mysql.c:1858: warning: implicit declaration of function
mysql_shutdown'_mysql.c: At top level:
_mysql.c:1878: syntax error before '' token
_mysql.c:1880: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_stat': _mysql.c:1882:
args' undeclared (first use in this function)_mysql.c:1883:
self' undeclared (first use in this function) _mysql.c:1885: warning: implicit declaration of function
mysql_stat'_mysql.c:1885: warning: assignment makes pointer from integer without a cast
_mysql.c: At top level:
_mysql.c:1899: syntax error before '' token
_mysql.c:1901: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_store_result': _mysql.c:1903:
r' undeclared (first use in this function)_mysql.c:1905:
args' undeclared (first use in this function) _mysql.c:1906:
self' undeclared (first use in this function)_mysql.c:1911: syntax error before ')' token
_mysql.c: At top level:
_mysql.c:1940: syntax error before '' token
_mysql.c:1942: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_thread_id': _mysql.c:1944:
args' undeclared (first use in this function)_mysql.c:1945:
self' undeclared (first use in this function) _mysql.c:1947: warning: implicit declaration of function
mysql_thread_id'_mysql.c: At top level:
_mysql.c:1960: syntax error before '' token
_mysql.c:1962: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_use_result': _mysql.c:1964:
r' undeclared (first use in this function)_mysql.c:1966:
args' undeclared (first use in this function) _mysql.c:1967:
self' undeclared (first use in this function)_mysql.c:1972: syntax error before ')' token
_mysql.c: At top level:
_mysql.c:1990: syntax error before '' token
_mysql.c:1991: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_dealloc': _mysql.c:1994:
self' undeclared (first use in this function)_mysql.c: At top level:
_mysql.c:2004: syntax error before '' token
_mysql.c:2005: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ConnectionObject_repr': _mysql.c:2007:
self' undeclared (first use in this function)_mysql.c: At top level:
_mysql.c:2021: syntax error before '' token
_mysql.c:2023: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ResultObject_data_seek': _mysql.c:2025:
args' undeclared (first use in this function)_mysql.c:2026: syntax error before ')' token
_mysql.c:2026: syntax error before ')' token
_mysql.c:2027: warning: implicit declaration of function
mysql_data_seek' _mysql.c:2027:
self' undeclared (first use in this function)_mysql.c: At top level:
_mysql.c:2036: syntax error before '' token
_mysql.c:2038: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ResultObject_row_seek': _mysql.c:2040:
MYSQL_ROW_OFFSET' undeclared (first use in this function)_mysql.c:2040: syntax error before "r"
_mysql.c:2041:
args' undeclared (first use in this function) _mysql.c:2042: syntax error before ')' token _mysql.c:2042: syntax error before ')' token _mysql.c:2043:
self' undeclared (first use in this function)_mysql.c:2048:
r' undeclared (first use in this function) _mysql.c:2048: warning: implicit declaration of function
mysql_row_tell'_mysql.c:2049: warning: implicit declaration of function
mysql_row_seek' _mysql.c: At top level: _mysql.c:2058: syntax error before '*' token _mysql.c:2060: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ResultObject_row_tell':_mysql.c:2061:
MYSQL_ROW_OFFSET' undeclared (first use in this function) _mysql.c:2061: syntax error before "r" _mysql.c:2062:
args' undeclared (first use in this function)_mysql.c:2063: syntax error before ')' token
_mysql.c:2063: syntax error before ')' token
_mysql.c:2064:
self' undeclared (first use in this function) _mysql.c:2069:
r' undeclared (first use in this function)_mysql.c: At top level:
_mysql.c:2075: syntax error before '' token
_mysql.c:2076: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ResultObject_dealloc': _mysql.c:2077:
self' undeclared (first use in this function)_mysql.c:2078: warning: implicit declaration of function
mysql_free_result' _mysql.c: At top level: _mysql.c:2085: syntax error before '*' token _mysql.c:2086: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ResultObject_repr':_mysql.c:2089:
self' undeclared (first use in this function) _mysql.c: At top level: _mysql.c:2315: syntax error before ')' token _mysql.c:2315: initializer element is not constant _mysql.c:2315: (near initialization for
_mysql_ConnectionObject_memberlist[0].offset')_mysql.c:2315: initializer element is not constant
_mysql.c:2315: (near initialization for
_mysql_ConnectionObject_memberlist[0]') _mysql.c:2322: syntax error before ')' token _mysql.c:2322: initializer element is not constant _mysql.c:2322: (near initialization for
_mysql_ConnectionObject_memberlist[1].offset')_mysql.c:2322: initializer element is not constant
_mysql.c:2322: (near initialization for
_mysql_ConnectionObject_memberlist[1]') _mysql.c:2329: syntax error before ')' token _mysql.c:2329: initializer element is not constant _mysql.c:2329: (near initialization for
_mysql_ConnectionObject_memberlist[2].offset')_mysql.c:2329: initializer element is not constant
_mysql.c:2329: (near initialization for
_mysql_ConnectionObject_memberlist[2]') _mysql.c:2336: syntax error before ')' token _mysql.c:2336: initializer element is not constant _mysql.c:2336: (near initialization for
_mysql_ConnectionObject_memberlist[3].offset')_mysql.c:2336: initializer element is not constant
_mysql.c:2336: (near initialization for
_mysql_ConnectionObject_memberlist[3]') _mysql.c:2343: syntax error before ')' token _mysql.c:2343: initializer element is not constant _mysql.c:2343: (near initialization for
_mysql_ConnectionObject_memberlist[4].flags')_mysql.c:2343: initializer element is not constant
_mysql.c:2343: (near initialization for
_mysql_ConnectionObject_memberlist[4]') _mysql.c:2344: initializer element is not constant _mysql.c:2344: (near initialization for
_mysql_ConnectionObject_memberlist[5]')_mysql.c:2406: syntax error before ')' token
_mysql.c:2406: initializer element is not constant
_mysql.c:2406: (near initialization for
_mysql_ResultObject_memberlist[0].offset') _mysql.c:2406: initializer element is not constant _mysql.c:2406: (near initialization for
_mysql_ResultObject_memberlist[0]')_mysql.c:2407: initializer element is not constant
_mysql.c:2407: (near initialization for
_mysql_ResultObject_memberlist[1]') _mysql.c:2412: syntax error before '*' token _mysql.c:2414: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ConnectionObject_getattr':_mysql.c:2417:
self' undeclared (first use in this function) _mysql.c:2417:
name' undeclared (first use in this function)_mysql.c: At top level:
_mysql.c:2440: syntax error before '*' token
_mysql.c:2442: warning: function declaration isn't a prototype
_mysql.c: In function
_mysql_ResultObject_getattr': _mysql.c:2445:
self' undeclared (first use in this function)_mysql.c:2445:
name' undeclared (first use in this function) _mysql.c: At top level: _mysql.c:2466: syntax error before '*' token _mysql.c:2469: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ConnectionObject_setattr':_mysql.c:2470:
v' undeclared (first use in this function) _mysql.c:2481:
name' undeclared (first use in this function)_mysql.c:2482:
self' undeclared (first use in this function) _mysql.c: At top level: _mysql.c:2491: syntax error before '*' token _mysql.c:2494: warning: function declaration isn't a prototype _mysql.c: In function
_mysql_ResultObject_setattr':_mysql.c:2495:
v' undeclared (first use in this function) _mysql.c:2506:
name' undeclared (first use in this function)_mysql.c:2507: `self' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1
I think the error at the beginning (not shown) is probably more important. Do you have all the required RPMs installed as described in README?
I am experiencing this error too. I have this error whenever I try to import MySQLdb:
[root@homepc MySQL-python-1.2.2]# python
Python 2.5 (r25:51908, Mar 13 2007, 14:22:25)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-linux-i686.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/local/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-linux-i686.egg/_mysql.pyc, but /usr/src/MySQL-python-1.2.2 is being added to sys.path
import sys, pkg_resources, imp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "MySQLdb/init.py", line 19, in <module>
import _mysql
File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module>
File "build/bdist.linux-i686/egg/_mysql.py", line 6, in bootstrap
ImportError: /root/.python-eggs/MySQL_python-1.2.2-py2.5-linux-i686.egg-tmp/_mysql.so: undefined symbol: __pure_virtual
I didnt encounter any errors while I was installing MySQLdb but only when I try to import it. I have MySQL 5.0 compiled from source and python 2.5 also from source.
[root@homepc MySQL-python-1.2.2]# mysql -V
mysql Ver 14.12 Distrib 5.0.27, for pc-linux-gnu (i686) using readline 5.0
[root@homepc MySQL-python-1.2.2]# python -V
Python 2.5
Before I installed xlrd but I didnt have problems with it.
Anything that I missed?
TIA.
You have some sort of compiler mismatch (incompatible APIs). Is your Python-2.5 seriously compiled with gcc-3.2.3? Did you build it yourself? Did you build MySQL yourself? Unless MySQl and Python (and _mysql.so) are all built with compatible compiler ABIs (typically these have changed between major GCC versions, particularly 3.2 through 4.1), you will have problems like this.
Thanks for the reply, Andy.
I must say that I have compiled Python-2.5 myself and I only have one version of gcc in my machine.
For MySQL however, there are two versions on my machine:
I have Perl scripts currently running in my machine that uses MySQL 5.0 but I want to convert those scripts to Python using the MySQLdb module.
I am sorry for being such a newbie to Python so I'm a little confused. :)
I'm having exactly the same trouble (undefined symbol: __pure_virtual on import of MySQLdb built from source) - my hands are a bit tied because I'm merely a user of my university's web resources, and I must work with what's provided. The server is Red Hat Linux, i686 architecture from what I can gather.
It appears that mysql and python were compiled using different versions of GCC (I think that mysql is a prebuilt binary from the mysql site):
% strings -a /usr/local/bin/python2.4 | grep -i gcc | uniq -d
GCC: (GNU) 3.2.3 20030502 (Red Hat Linux 3.2.3-46)
% gcc --version
gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-58)
% mysql --version
mysql Ver 14.12 Distrib 5.0.27, for pc-linux-gnu (i686) using readline 5.0
% strings -a mysql | grep -i gcc | uniq -d
GCC: (GNU) 2.95.3 20010315 (SuSE)
So is there anything I can do to get a functioning version of MySQLdb on this machine? I can compile from source, but only gcc 3.2.3 is installed on the system. I'm getting a bit desperate because the system maintainers are about to switch to this architecture, and I have much software using this module running on the current (AIX) system (I'm trying this out in a development environment that they provide).
Thanks for any ideas.
Noah
Something I left out: when I tried to compile MySQLdb using my new build of mysql, installation failed with an error that mysqlclient_r couldn't be found. I noticed that there was a mysqlclient_r.a in the lib directory of the binary distribution of mysql that I had installed previously - I copied this to lib/mysql in my newly compiled installation, and then MySQLdb compiled without errors.
Was this an error? I guess this may be reportable as a separate issue: it appears that MySQLdb requires components that are not included in recent source distributions of mysql (unless I've caused this problem with my selection of compile parameters).
Thanks again...
An update:
I recompiled mysql from source:
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.37.tar.gz/from/http://mirror.x10.com/mirror/mysql/
tar -xzvf mysql-5.0.37.tar.gz
cd mysql-5.0.37
INSTALLDIR=$HOME/mysql-5.0.37-linux
mkdir $INSTALLDIR
see http://dev.mysql.com/doc/refman/5.0/en/installing-source.html
CFLAGS="-O3"
CXX=gcc
CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=$INSTALLDIR --enable-assembler
make
make install
cp -r lib scripts support-files tests $INSTALLDIR
Now I get:
% strings -a mysql | grep -i gcc | uniq -d
GCC: (GNU) 3.2.3 20030502 (Red Hat Linux 3.2.3-54)
And still the same error on import of MySQLdb.
I'm at a loss.