64bit linux系統安裝DBD問題

來源:互聯網
上載者:User

結論就是:

mysql提供的靜態庫,沒有加-fPIC選項,導致DBD編譯失敗

解決:

1. 加fPIC,重新編譯libmysqlclient.a

2. 使用動態庫

Description:I am trying to compile the DBD::mysql perl module on an x86_64 platform and I get thefollowing errors:[some stuff cut out here]rm -f blib/arch/auto/DBD/mysql/mysql.soLD_RUN_PATH="/usr/lib" /usr/bin/perl myld cc  -shared -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so     \   -L/usr/local/mysql/lib -lmysqlclient -lcrypt -lnsl -lm -lz   \   /usr/bin/ld: /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): relocation R_X86_64_32can not be used when making a shared object; recompile with -fPIC/usr/local/mysql/lib/libmysqlclient.a: could not read symbols: Bad valuecollect2: ld returned 1 exit statuschmod 755 blib/arch/auto/DBD/mysql/mysql.sochmod: cannot access `blib/arch/auto/DBD/mysql/mysql.so': No such file or directorymake: *** [blib/arch/auto/DBD/mysql/mysql.so] Error 1After a couple of days of digging around, this is what I've found:1.  If only static libraries are provided, they should be compiled with -fPIC on thex86_64 platform (this is different from regular x86).  This allows other people to createtheir own shared libraries from your static libraries by linking against them, which iswhat DBD::mysql is trying to do with libmysqlclient.a.  I found this information athttp://www.x86-64.org/lists/discuss/msg05760.html -- even though it is not about mysql,it is about this specific linker error.2.  This same bug was filed under Mysql Bug #4670, which was closed with a work aroundlisted (complile a dynamic libmysqlclient library and link against that instead).  Ibelieve that it is still a bug, however, because only a workaround is listed--the actualfix would be to link all static libraries for x86_64 platforms with -fPIC.I will attempt to compile my own libmysqlclient with -fPIC, but it would save a lot ofheadaches for other people if they came compiled that way with the binary distributions.How to repeat:Try to compile DBD::mysql on an x86_64 platform with static mysql libraries (no dynamiclibraries were provided with the binary distributions)Suggested fix:Begin compiling static libraries (specifically libmysqlclient.a) with -fPIC on the x86_64platform or provide dynamic libraries in addition to the static libraries.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.