Tuesday, February 1, 2022

[SOLVED] Unable to install MySQL-python under ubuntu 12.04

Issue

I'm trying to install mysql-python module in ubuntu 12.04 under virtualenv environment but unexpectedly faced with error below:

building '_mysql' extension

creating build/temp.linux-x86_64-2.7

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1

In file included from /usr/include/mysql/mysql.h:64:0,

                 from _mysql.c:46:

/usr/include/mysql/mysql/client_plugin.h:97:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]

In file included from /usr/include/mysql/mysql.h:64:0,

                 from _mysql.c:46:

/usr/include/mysql/mysql/client_plugin.h:107:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]

gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu
-lmysqlclient_r -lpthread -lz -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so

/usr/bin/ld: cannot find -lmysqlclient_r

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

I've run:

sudo apt-get install mysql-server mysql-client python-mysqldb libmysqlclient-dev python-dev

but it didn't help.


Solution

The problem was that libmysqlclient.so didn't have symlinks described in https://github.com/javer/gentoo-overlay/issues/4#issuecomment-30748799



Answered By - thundera
Answer Checked By - Mildred Charles (WPSolving Admin)