11

我正在尝试为我的 RPI 编译 Qt 5 库,但它总是崩溃。

这些是我试图遵循的指南:

http://qt-project.org/wiki/RaspberryPi_Beginners_guide
http://qt-project.org/wiki/RaspberryPi

我已经根据指南下载了交叉编译器和 sysroot-image,并从 git repo 中提取了 Qt5 源代码。

在遵循其中一个指南之后,我现在被困在make.

这是我收到的错误:

.obj/release-shared/qlibrary_unix.o: In function `QLibraryPrivate::load_sys()':
qlibrary_unix.cpp:(.text+0xf84): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/esa/qtonpi/rpi_image/usr/lib/arm-linux-gnueabihf/libdl.a(dlopen.o): In function `dlopen':
(.text+0xc): undefined reference to `__dlopen'
/home/esa/qtonpi/rpi_image/usr/lib/arm-linux-gnueabihf/libdl.a(dlclose.o): In function `dlclose':
(.text+0x0): undefined reference to `__dlclose'
/home/esa/qtonpi/rpi_image/usr/lib/arm-linux-gnueabihf/libdl.a(dlsym.o): In function `dlsym':
(.text+0xc): undefined reference to `__dlsym'
/home/esa/qtonpi/rpi_image/usr/lib/arm-linux-gnueabihf/libdl.a(dlerror.o): In function `dlerror':
(.text+0x0): undefined reference to `__dlerror'
/home/esa/qtonpi/rpi_image/usr/lib/arm-linux-gnueabihf/libm.a(feholdexcpt.o): In function `feholdexcept':
(.text+0x48): undefined reference to `_dl_hwcap'
/home/esa/qtonpi/rpi_image/usr/lib/arm-linux-gnueabihf/libm.a(fesetenv.o): In function `fesetenv':
(.text+0x64): undefined reference to `_dl_hwcap'
collect2: virhe: ld:n paluuarvo oli 1                                           # collect2: error: ld returnvalue was 1
make[2]: *** [../../lib/libQt5Core.so.5.0.0] Virhe 1                            # Error 1
make[2]: Poistutaan hakemistosta "/home/esa/qtonpi/qt5/qtbase/src/corelib"      # Leaving directory
make[1]: *** [sub-corelib-make_first] Virhe 2                                   # Error 2
make[1]: Poistutaan hakemistosta "/home/esa/qtonpi/qt5/qtbase/src"              # Leaving directory
make: *** [sub-src-make_first] Virhe 2                                          # Error 2
4

5 回答 5

12

修复 sysroot 中库的路径。一些库是指向绝对路径的符号链接,这些符号链接在放置在系统中时会被破坏。检查类似 /home/esa/qtonpi/rpi_image/usr/lib/arm-linux-gnueabihf/libdl.so 或类似的东西。您应该看到那些指向绝对路径的已损坏符号链接。修复所有这些。在您报告的文件中,为此目的提供了一个脚本。你运行它了吗(https://gitorious.org/cross-compile-tools/cross-compile-tools/blobs/master/fixQualifiedLibraryPaths)?

如果您仍然遇到麻烦,也请尝试检查一下我写了一些注释,从 git 编译最新版本的 wheezy 图像。

于 2012-11-29T13:31:21.830 回答
3

对于那些尝试了现有答案但没有奏效的人的答案:

/usr/lib/您下载的 Raspbian 映像可能在文件夹中不包含 libdl 和 libdm 的符号链接。

在这种情况下, fixQualifiedLibraryPaths 无法帮助您,因为它找不到符号链接。复制libdl.solibm.so可能会失败,例如,如果您使用闪存驱动器从现有的 Raspberry Pi 复制数据,它不会将它们复制为符号链接,而是会复制库本身。但是,要使构建成功,似乎需要符号链接。

我查看了Raspberry Pi 文件夹中的内容libdl和指向libdm/usr/lib/

cd /usr/lib/arm-linux-gnueabihf/
ls -l libld.so libm.so

对找到的文件执行相同的操作,直到它们不再是符号链接而是普通文件。

在我的系统上,事实证明它们被调用libdl-2.13.solibm-2.13.so驻留在/lib/arm-linux-gnueabihf/而不是/usr/lib/...

回到我的电脑,我在文件夹中找到了这些确切的/lib/arm-linux-gnueabihf/文件(如果你没有找到它们,你可以从你的 Raspberry Pi 复制它们)。所以我在/usr/lib/arm-linux-gnueabihf/文件夹中为它们创建了符号链接:

sudo ln -s /lib/arm-linux-gnueabihf/libdl-2.13.so /usr/lib/arm-linux-gnueabihf/libdl.so
sudo ln -s /lib/arm-linux-gnueabihf/libm-2.13.so /usr/lib/arm-linux-gnueabihf/libm.so

至此,qtbase就编译成功了。

(请注意,为了继续从 Qt 进行交叉编译,您必须将 SD 卡的映像安装在您的 PC 上(如指南中所述),但这还不够:您必须在启动 Qt 之前安装它创作者)

于 2015-10-21T08:25:52.667 回答
2

试试这个

ln -s /mnt/raspberry-rootfs/lib/arm-linux-gnueabihf /lib/

Pi基本上,当链接上的so文件时,似乎已经指定了绝对路径(/lib/),因此/mnt/raspberry-rootfs它们被破坏了。

将 Pi 链接/lib/arm-linux-gnueabihf到 Pc 的/lib目录可以修复错误的链接并允许 QT 编译。这是一个肮脏的把戏,但它有效。

如果没有libdl/ libmPi则需要将 SD 卡插回Pi,启动并安装它们。显然,您需要从 SD 卡在 PC 上创建一个新映像并将其安装在/mnt/raspberry-rootfs

于 2015-11-18T16:20:40.087 回答
1

这可能是因为本地目录中缺少libdl.soand (只有and )。从 Raspberry Pi 复制这两个文件应该可以使编译成功。libm.sorootfs/usr/lib/arm-linux-gnueabihflibdl.alibm.a

于 2014-04-25T12:13:59.447 回答
1

而不是 fixQualifiedLibraryPaths 使用:

cd <folder-with-sysroot-subfolder>
wget https://raw.githubusercontent.com/riscv/riscv-poky/master/script/sysroot-relativelinks.py
chmod +x sysroot-relativelinks.py
./sysroot-relativelinks.py sysroot
于 2017-12-04T12:25:36.323 回答