首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >构建MySQL Python模块时出错

构建MySQL Python模块时出错
EN

Stack Overflow用户
提问于 2012-01-08 18:56:11
回答 1查看 1.7K关注 0票数 3

我正在尝试为我的Diskstation 1511 NAS (Intel Atom,Linux 2.6 embedded)构建Python mysql驱动程序安装。我有MySQL-python-1.2.3。虽然MySQL安装在网络连接存储上,但它没有包含mysql_config实用程序,因此编译了一个完整的MySQL安装。

在尝试构建时,我收到以下错误消息(请参阅下面的详细信息)。任何帮助都是非常感谢的。

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2012-11-02 11:30:53

我在上面有同样的错误。问题是它缺少一些头文件。快速谷歌显示,它需要python-dev,但它是默认的Python2.7。在Python2.6中,有一个包python2.6-dev。所以我们需要的是:

代码语言:javascript
复制
$ sudo apt-get install python2.6-dev
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8776934

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档