在Linux 64位的mysql-python的静态链接 [英] mysql-python static linking on Linux 64-bit

查看:272
本文介绍了在Linux 64位的mysql-python的静态链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人试过静态64位Linux中的MySQL,Python和MySQL客户端库?

  GCC -pthread -shared建设/ temp.linux-x86_64-2.6 / _mysql.o /家庭/ APY / MySQL-
蟒蛇-1.2.3c1 / MySQL的,42年1月5日/我/ lib中/ MySQL的/ libmysqlclient_r.a -L /家庭/ APY / MYS
QL-蟒蛇-1.2.3c1 / MySQL的,42年1月5日/我/ lib中/ MySQL的-lmysqlclient_r -lz -lpthread -lcrypt -lnsl  - 
LM -lpthread -o编译/ lib.linux-x86_64-2.6 / _mysql.so
/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../x86_64-suse-linux/bin/ld:/家庭/ A
PY / MySQL的 - 蟒蛇-1.2.3c1 / MySQL的,42年1月5日/我/ lib中/ MySQL的/ libmysqlclient_r.a(libmys
ql.o):对`局部符号搬迁R_X86_64_32作出SHA时,不能使用
红色的物体;重新编译-fPIC
/home/apy/MySQL-python-1.2.3c1/mysql-5.1.42/i/lib/mysql/libmysqlclient_r.a:看不懂的符号:错误的价值
 

另请参阅: http://stackoverflow.com/questions/1966322

解决方案
  1. 设置 CFLAGS = - 子卡环境变量。 (原因

  2. - 禁用共享 ./配置(除了 --enable-静态,这是)构建MySQL时。

Has anyone tried to statically link mysql-python with mysql client library on 64-bit Linux?

gcc -pthread -shared build/temp.linux-x86_64-2.6/_mysql.o /home/apy/MySQL-
python-1.2.3c1/mysql-5.1.42/i/lib/mysql/libmysqlclient_r.a -L/home/apy/MyS
QL-python-1.2.3c1/mysql-5.1.42/i/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -
lm -lpthread -o build/lib.linux-x86_64-2.6/_mysql.so
/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../x86_64-suse-linux/bin/ld: /home/a
py/MySQL-python-1.2.3c1/mysql-5.1.42/i/lib/mysql/libmysqlclient_r.a(libmys
ql.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a sha
red object; recompile with -fPIC
/home/apy/MySQL-python-1.2.3c1/mysql-5.1.42/i/lib/mysql/libmysqlclient_r.a: could not read symbols: Bad value

See also: http://stackoverflow.com/questions/1966322

解决方案

  1. Set CFLAGS="-fPIC" environment variable. (reason)

  2. Pass --disable-shared to ./configure (besides --enable-static, that is) when building mysql.

这篇关于在Linux 64位的mysql-python的静态链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆