By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,714 Members | 750 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,714 IT Pros & Developers. It's quick & easy.

Undefined symbol __pure_virtual when importing MySQLdb

P: n/a
I downloaded MySQL-python-1.2.1 from SourceForge and installed it on a
Mandrake system (Mandrake Linux 9.2 3.3.1-2mdk on linux2).

The installation was successful. The gcc version is 3.3.

My Python version is 2.4.2. When I import MySQLdb, I get an error
which says that __pure_virtual is an undefined symbol.

Look:
>>import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/python2.4/site-packages/MySQLdb/__init__.py", line
19, in ?
import _mysql
ImportError: /usr/local/python2.4/site-packages/_mysql.so: undefined
symbol: __pure_virtual

By the way, mysql (5.0.27-standard)is running OK on the Mandrake
system. Look:

[antonyliu@myhost antonyliu]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13 to server version: 5.0.27-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

I have googled hard, and did see someone asking the same question, but
haven't found a good solution to this problem. Could anyone give me a
hint? Thanks a lot!

Jan 5 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
an***********@yahoo.com wrote:
I have googled hard, and did see someone asking the same question, but
haven't found a good solution to this problem. Could anyone give me a
hint? Thanks a lot!
googling for "undefined symbol: __pure_virtual" brings up hundreds of
posts on this topic, and the answer is *always* to make sure that you're
linking with a version of the C++ libraries that matches your compiler.

</F>

Jan 5 '07 #2

P: n/a
Fredrik Lundh wrote:
an***********@yahoo.com wrote:
I have googled hard, and did see someone asking the same question, but
haven't found a good solution to this problem. Could anyone give me a
hint? Thanks a lot!

googling for "undefined symbol: __pure_virtual" brings up hundreds of
posts on this topic, and the answer is *always* to make sure that you're
linking with a version of the C++ libraries that matches your compiler.

</F>
Hi, thanks. I followed the strategy provided at the following url

http://www.mail-archive.com/db******.../msg27851.html

by adding "-lmygcc" to the end of the librarys to link. I added it to
the end of this line in the mysql_config script like so:

libs=" $ldflags -L$pkglibdir -lmysqlclient -lz -lcrypt -lnsl -lm
-lmygcc "

And then I recompiled the MySQL-python-1.2.1 package, but the same
problem remains.

Jan 5 '07 #3

P: n/a
an***********@yahoo.com wrote:
Fredrik Lundh wrote:
an***********@yahoo.com wrote:
I have googled hard, and did see someone asking the same question, but
haven't found a good solution to this problem. Could anyone give me a
hint? Thanks a lot!
googling for "undefined symbol: __pure_virtual" brings up hundreds of
posts on this topic, and the answer is *always* to make sure that you're
linking with a version of the C++ libraries that matches your compiler.

</F>

Hi, thanks. I followed the strategy provided at the following url

http://www.mail-archive.com/db******.../msg27851.html

by adding "-lmygcc" to the end of the librarys to link. I added it to
the end of this line in the mysql_config script like so:

libs=" $ldflags -L$pkglibdir -lmysqlclient -lz -lcrypt -lnsl -lm
-lmygcc "

And then I recompiled the MySQL-python-1.2.1 package, but the same
problem remains.
I tried using -lgcc as some people suggested in some forum, but it does
not resolve the problem. It looks like many people are having this
problem, but no solution has been offered so far. Anybody has a clue?
Thanks.

Jan 5 '07 #4

P: n/a
hg
an***********@yahoo.com wrote:
I downloaded MySQL-python-1.2.1 from SourceForge and installed it on a
Mandrake system (Mandrake Linux 9.2 3.3.1-2mdk on linux2).

The installation was successful. The gcc version is 3.3.

My Python version is 2.4.2. When I import MySQLdb, I get an error
which says that __pure_virtual is an undefined symbol.

Look:
>>>import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/python2.4/site-packages/MySQLdb/__init__.py", line
19, in ?
import _mysql
ImportError: /usr/local/python2.4/site-packages/_mysql.so: undefined
symbol: __pure_virtual

By the way, mysql (5.0.27-standard)is running OK on the Mandrake
system. Look:

[antonyliu@myhost antonyliu]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13 to server version: 5.0.27-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

I have googled hard, and did see someone asking the same question, but
haven't found a good solution to this problem. Could anyone give me a
hint? Thanks a lot!

Hi,

I can only say that it runs fine under Mandriva 2007 ... and that Mandriva
went to gcc V4 long after 9.2 ... maybe an issue here.

Regards,

hg

Jan 5 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.