我正在交叉编译一个 Lazarus 程序,在 64 位 Ubuntu 14.04 Trusty Tahr 系统上创建一个 32 位程序,当我得到这个消息时,一切显然都编译到最后
/usr/bin/ld: cannot find -lglib-2.0
缺少该库的全名是什么,其缺失会导致此错误消息?
libc6-dev:i386
似乎是最有可能的库,但是当我尝试使用 apt 安装它时,指示build-essential g++ gcc gcc-multilib
将被删除,所以我中止了它。
sudo apt-get install libc6-dev:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
linux-libc-dev linux-libc-dev:i386
Suggested packages:
glibc-doc:i386 manpages-dev:i386
Recommended packages:
gcc:i386 c-compiler:i386
The following packages will be REMOVED
build-essential g++ gcc gcc-multilib
The following NEW packages will be installed
libc6-dev:i386 linux-libc-dev:i386
The following packages will be upgraded:
linux-libc-dev
1 to upgrade, 2 to newly install, 4 to remove and 18 not to upgrade.
Need to get 3,126 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
事实证明,这是libglib2.0-0:i386
包。它已在较早安装,但尚未完全配置。
它存在于/lib/i386-linux
目录中,我必须创建一个指向它的符号链接,将其包含在 Free Pascal 使用的fpc.cfg
配置文件中。
locate libglib | grep ^/lib
产生:
/lib/i386-linux-gnu/libglib-2.0.so.0
/lib/i386-linux-gnu/libglib-2.0.so.0.4002.0
/lib/x86_64-linux-gnu/libglib-2.0.so.0
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0
我用预期的名称将其符号链接:
ln -s /lib/i386-linux-gnu/libglib-2.0.so.0 /lib/i386-linux-gnu/libglib-2.0.so
然后添加到拉撒路安装fpc.cfg
文件中
#ifdef cpui386
-Fl/usr/lib32
-Fl/lib/i386-linux-gnu
#endif