Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > "mysql.h: No such file or directory" when building MySQL-python

Reply
Thread Tools

"mysql.h: No such file or directory" when building MySQL-python

 
 
francescomoi@europe.com
Guest
Posts: n/a
 
      04-27-2005
Hi.

I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2:
----------------------------------
[ ]# export PATH=$PATH:/usr/local/mysql/bin/
[ ]# export mysqlclient=mysqlclient_r
[ ]# python setup.py clean
[ ]# python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
creating build/temp.linux-i686-2.3
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
-mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
_mysql.c -o build/temp.linux-i686-2.3/_mysql.o -I'/usr/include/mysql'
_mysql.c:41:19: mysql.h: No such file or directory
------------------------------------

I don't understand why I get this error message, since I usually build
MySQL+C programs
by using:
gcc -o myprogram -I'/usr/local/mysql/include/mysql'
-L'/usr/local/mysql/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm
myprogram.c

My server configuration:
---------------------------
[ ]# /usr/local/mysql/bin/mysql_config
--cflags [-I'/usr/local/mysql/include/mysql']
--libs [-L'/usr/local/mysql/lib/mysql' -lmysqlclient
-lz -lcrypt -lnsl -lm]
--socket [/tmp/mysql.sock]
--port [3306]
--version [3.23.58]
----------------------------
[ ]# find . -name "mysql.h"
../usr/src/php-4.3.10/ext/mysql/libmysql/mysql.h
../usr/src/mysql-3.23.58/include/mysql.h
../usr/src/mysql-4.1.9/include/mysql.h
../usr/include/mysql/mysql.h
../usr/local/mysql/include/mysql/mysql.h
------------------------------
[ ]# locate libmysqlclient
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.so
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.a
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.so.10
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.so.10.0.0
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.lai
/usr/src/mysql-3.23.58/libmysql/.libs/libmysqlclient.la
/usr/src/mysql-3.23.58/libmysql/libmysqlclient.la
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.so
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.a
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.so.14
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.lai
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.so.14.0.0
/usr/src/mysql-4.1.9/libmysql/.libs/libmysqlclient.la
/usr/src/mysql-4.1.9/libmysql/libmysqlclient.la
/usr/local/mysql/lib/mysql/libmysqlclient.la
/usr/local/mysql/lib/mysql/libmysqlclient.so.10.0.0
/usr/local/mysql/lib/mysql/libmysqlclient.so
/usr/local/mysql/lib/mysql/libmysqlclient.a
/usr/local/mysql/lib/mysql/libmysqlclient.so.10
----------------------------------

Any suggestion? Thank you very much.

 
Reply With Quote
 
 
 
 
Andy Dustman
Guest
Posts: n/a
 
      04-28-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2:

....
> gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
> -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
> _mysql.c -o build/temp.linux-i686-2.3/_mysql.o -I'/usr/include/mysql'
> _mysql.c:41:19: mysql.h: No such file or directory

....
> My server configuration:
> ---------------------------
> [ ]# /usr/local/mysql/bin/mysql_config
> --cflags [-I'/usr/local/mysql/include/mysql']
> --libs [-L'/usr/local/mysql/lib/mysql' -lmysqlclient
> -lz -lcrypt -lnsl -lm]
> --socket [/tmp/mysql.sock]
> --port [3306]
> --version [3.23.58]

....
> Any suggestion? Thank you very much.


Fedora's mysql_config puts quotes around the directory names, which
confuses things. Try MySQL-python-1.2.1c1. I don't think this entirely
solves the problem, but I think I know how to fix it for 1.2.1c2. But
try it and report your results here:

https://sourceforge.net/tracker/inde...07&atid=374932

 
Reply With Quote
 
 
 
 
francescomoi@europe.com
Guest
Posts: n/a
 
      05-11-2005
Thank you Andy for your answer.

I tried by using '1.2.1c1' and '1.2.1c2', but with no success:
---------------
creating build/temp.linux-i686-2.3
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
-mcpu=i686 - D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
_mysql.c -o build/temp.linu x-i686-2.3/_mysql.o -I'/usr/include/mysql'
_mysql.c:41:19: mysql.h: No such file or directory
--------------------

Finally I decided to copy '/usr/include/mysql/*.*' to my work
directory,
and I managed to build it. But when trying to execute a simple test,
I get this error message:
---------
Traceback (most recent call last):
File "./db.py", line 7, in ?
db = "test")
File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line 66,
in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
134, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2002, "Can't connect to local
MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")
-----------------------

Any suggestion?. Regards


Andy Dustman wrote:
> (E-Mail Removed) wrote:
>
> > I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2:

> ...
> > gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -march=i386
> > -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/python2.3 -c
> > _mysql.c -o build/temp.linux-i686-2.3/_mysql.o

-I'/usr/include/mysql'
> > _mysql.c:41:19: mysql.h: No such file or directory

> ...
> > My server configuration:
> > ---------------------------
> > [ ]# /usr/local/mysql/bin/mysql_config
> > --cflags [-I'/usr/local/mysql/include/mysql']
> > --libs [-L'/usr/local/mysql/lib/mysql'

-lmysqlclient
> > -lz -lcrypt -lnsl -lm]
> > --socket [/tmp/mysql.sock]
> > --port [3306]
> > --version [3.23.58]

> ...
> > Any suggestion? Thank you very much.

>
> Fedora's mysql_config puts quotes around the directory names, which
> confuses things. Try MySQL-python-1.2.1c1. I don't think this

entirely
> solves the problem, but I think I know how to fix it for 1.2.1c2. But
> try it and report your results here:
>
>

https://sourceforge.net/tracker/inde...07&atid=374932

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefighters at the site of WTC7 "Move away the building is going to blow up, get back the building is going to blow up." Midex Python 24 05-07-2007 04:23 AM
Wireless building-to-building 101 Tim Jacob Wireless Networking 2 02-17-2006 09:46 AM
"No such interface supported" when building CAB project Brian Moeskau ASP .Net 0 11-12-2003 04:32 PM
Building to Building wireless Patriot Cisco 2 11-04-2003 05:07 PM



Advertisments