刚从 Löve 开始,我很喜欢它!我目前正在 Ubuntu 14.04 下对其进行测试。
我能够毫无问题地编译 love 0.8.0,但我在从 bitbucket 编译 0.9.2 时遇到问题。看来,我可能是被一个大灰狼吃掉了……
链接时出现此错误,原因是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
根据这个 StackOverflow 条目,似乎默认的 libturbojpeg 二进制文件通过 apt-get 安装在 Ubuntu 中:
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.