【发布时间】:2015-06-06 08:55:02
【问题描述】:
从 Löve 开始,我很喜欢它! 我目前正在 Ubuntu 14.04 下测试它。
我能够毫无问题地编译 love 0.8.0,但我在从 bitbucket 编译 0.9.2 时遇到问题。 看来,我可能是eaten by a grue...
链接时出现此错误,由于libturbojpeg:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
根据this StackOverflow entry,似乎是通过apt-get在Ubuntu中安装了默认的libturbojpeg二进制:
tomas@ubuntu:~/tomas/love/love-0.9.2-bitbucket$ dpkg -L libjpeg-turbo8-dev | grep libturbojpeg.a
/usr/lib/x86_64-linux-gnu/libturbojpeg.a
tomas@ubuntu:~/tomas/love/love-0.9.2-bitbucket$ dpkg -l libjpeg-turbo8-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================================-======================-======================-=========================================================================
ii libjpeg-turbo8-dev:amd64 1.3.0-0ubuntu2 amd64 Development files for the IJG JPEG library
不是用-fPIC 编译的,所以我想我必须得到它的源代码,用那个选项重新编译它,并在 löve 的构建过程中修改一些内容以指向编译好的。
我是朝着正确的方向前进,还是我错过了什么?
问候, 汤姆
PD:我想知道为什么在这种特定情况下需要使用 -fPIC 编译这个库......
-fPIC
If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the
global offset table. This option makes a difference on the m68k, PowerPC and SPARC.
【问题讨论】: