2012-01-08 3 views
3

Я пытаюсь установить установку драйвера mysql на Python для своего NAS-платформы Diskstation 1511 (встроенный Intel Atom, Linux 2.6). У меня есть MySQL-python-1.2.3. Хотя MySQL установлен на NAS, он не включил утилиту mysql_config, поэтому скомпилировал полную установку MySQL.Ошибка при создании модуля MySQL Python

При попытке сборки я получаю следующее сообщение об ошибке (см. Ниже). Любая помощь приветствуется.

DiskStation> python2.6 setup.py build 
running build 
running build_py 
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.6/MySQLdb 
running build_ext 
building '_mysql' extension 
/opt/bin/gcc -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql-src/include/mysql -I/opt/include/python2.6 -c _mysql.c -o build/temp.linux-x86_64-2.6/_mysql.o 
In file included from _mysql.c:36: 
/usr/local/mysql-src/include/mysql/my_config.h:1063:1: warning: "SIZEOF_OFF_T" redefined 
In file included from /opt/include/python2.6/Python.h:8, 
       from pymemcompat.h:10, 
       from _mysql.c:29: 
/opt/include/python2.6/pyconfig.h:907:1: warning: this is the location of the previous definition 
_mysql.c: In function '_escape_item': 
_mysql.c:1050: warning: dereferencing type-punned pointer will break strict-aliasing rules 
_mysql.c: In function 'init_mysql': 
_mysql.c:2836: warning: dereferencing type-punned pointer will break strict-aliasing rules 
_mysql.c:2838: warning: dereferencing type-punned pointer will break strict-aliasing rules 
_mysql.c:2840: warning: dereferencing type-punned pointer will break strict-aliasing rules 
_mysql.c:2842: warning: dereferencing type-punned pointer will break strict-aliasing rules 
/opt/bin/gcc -shared -L/opt/lib -Wl,-rpath,/opt/lib -Wl,-rpath-link,/opt/lib build/temp.linux-x86_64-2.6/_mysql.o -L/usr/syno/mysql/lib/mysql -L/opt/lib -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -lpython2.6 -o build/lib.linux-x86_64-2.6/_mysql.so 
/opt/lib/gcc/i686-linux-gnu/4.2.1/../../../../i686-linux-gnu/bin/ld: cannot find -lmysqlclient_r 
collect2: ld returned 1 exit status 
error: command '/opt/bin/gcc' failed with exit status 1 
+0

Я думаю будет THREADSAFE клиента вещи ... в файле site.cfg, вы можете установить THREADSAFE ложь и посмотреть, если это заглушает ошибку? сделал googling для mysqlclient_r, не вернул ничего полезного? – David

+0

Да, это работает, спасибо большое. – user1135334

ответ

6

У меня такая же ошибка выше. Проблема в том, что ему не хватает некоторых файлов заголовков. Быстрый Google показывает, что ему нужен python-dev, но он предназначен для Python по умолчанию (2.7). С python 2.6 есть пакет python2.6-dev. Так что нам нужно:

$ sudo apt-get install python2.6-dev 
+0

У меня есть 'Python2.7.2' для устранения ошибки, которую я использовал' sudo apt-get install python2.7-dev' работал отлично. –