Gcc error when installing oursql (Python 3)

We have just upgraded our servers and are in the final(ish!) stages of the migration, I’m just finishing up installing the required python modules, but I am having some problems with the very last one.

One of my colleagues uses SQLAlchemy within his own virtualenv (Python 3) and as part of that he uses oursql as the driver.

I have been getting several gcc errors when trying to install oursql, which is giving me a bit of a headache. It seems to be complaining about a missing mysql.h file – I’m not sure where it is, can anyone advise? We have upgraded mysql to 5.6 so I wonder if that has had any effect.

Any help is greatly appreciated!

[root@679623-db1:~/oursql-0.9.4]
# python3 setup.py install
running install
running build
running build_ext
skipping 'oursqlx/oursql.c' Cython extension (up-to-date)
building 'oursql' extension
mysql_config --cflags
gcc -pthread -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.4m -c oursqlx/oursql.c -o build/temp.linux-x86_64-3.4/oursqlx/oursql.o -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
In file included from oursqlx/oursql.c:235:
oursqlx/compat.h:13:19: error: mysql.h: No such file or directory
oursqlx/compat.h:14:26: error: mysqld_error.h: No such file or directory
oursqlx/compat.h:15:20: error: errmsg.h: No such file or directory
oursqlx/compat.h:19:2: error: #error "This driver requires at least MySQL 4.1.2." 
...

We have (as far as we know) all the required mysql libs etc installed:

[root@679623-db1:~/oursql-0.9.4]
# yum list mysql*
Installed Packages
MySQL-python.x86_64
mysql56u.x86_64
mysql56u-common.x86_64
mysql56u-server.x86_64
mysqlclient16.x86_64

EDIT: Sorry I forgot to add that we are running RHEL 6


Source: gcc

Leave a Reply