为 Nitrogen6x 构建 Qt 5 时出现 Libm 重定位错误 [英] Libm relocation error when building Qt 5 for Nitrogen6x

查看:20
本文介绍了为 Nitrogen6x 构建 Qt 5 时出现 Libm 重定位错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在由 *i.MX6Q` 提供支持的 Nitrogen6x 开发板上构建 Qt 5.

I am trying to build Qt 5 on a Nitrogen6x board powered by an *i.MX6Q`.

我已经在板上安装了 Debian/wheezy 并且正在使用 Ubuntu 12.10 机器进行交叉编译.

I've installed Debian/wheezy on the board and am using an Ubuntu 12.10 machine for cross-compiling.

配置 Qt 就像一个魅力,但我被困在 make 步骤中.这是我运行的配置脚本:

Configuring Qt works like a charm but I am stuck in the make step. This is the configure script I run:

./configure -v -opensource -confirm-license  -reduce-relocations -no-pch -no-xcb -no-opengl -opengl es2  -qt-libpng -qt-zlib -qt-xkbcommon -qt-xcb -qt-pcre -qt-libjpeg -qt-sql-mysql -optimized-qmake\
   -make libs -device imx6 \
   -compile-examples   \
   -device-option CROSS_COMPILE=/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabi- \
   -sysroot /media/finn/d72e3b65-b529-4e5c-9d30-872e1b0c9973 \
   -prefix /opt/qt5

这是我在 make 过程中大约 5 分钟收到的错误:

And this is the error I receive about 5 minutes into the make process:

/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: 
/media/finn/d72e3b65-b529-4e5c-9d30-872e1b0c9973/usr/lib/libm.a(mpa.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/media/finn/d72e3b65-b529-4e5c-9d30-872e1b0c9973/usr/lib/libm.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

我之前遇到过同样的错误,当它尝试访问 libz.a 但将 qt-zlib 参数添加到配置命令时解决了该问题.

I've run into the same error before, when it was trying to access libz.a but adding the qt-zlib parameter to the configure command fixed that issue.

许多文章指出应该重新编译受影响的应用程序/库,但我认为这是不可能的,因为 libm 是 libc6 的一部分.

Many articles state that affected applications/libraries should be recompiled, however I don't think that's possible as libm is part of libc6.

我已经尝试使用 aptitude remove libc6-dev zlib1g-dev g++-4.6 重新安装它和 apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev build-essential

I already tried reinstalling it using aptitude remove libc6-dev zlib1g-dev g++-4.6 and apt-get install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev build-essential

遗憾的是这并没有解决问题.

Sadly this did not fix the problem.

Debian 已使用官方网络安装程序以及 Boundarydevices(板的制造商)提供的内核和覆盖进行安装.

Debian has been installed using the official network installer as well as a Kernel and an Overlay provided by Boundarydevices, the manufacturer of the board.

有人知道如何解决这个问题吗?

Does anyone has an idea how to fix this?

我的下一步是安装一个全新的 Debian 系统,但我真的很想避免这种情况.

My next step would be to install a completely new Debian system but I would really like to avoid that.

使用 -static 选项编译 qtbase 对我有用,但是在 make 步骤中尝试构建 qtdeclarative 时遇到此错误:

Compiling qtbase with -static option works for me, however I am running into this error when trying to build qtdeclarative during the make step:

    /home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find crt1.o: No such file or directory
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find crti.o: No such file or directory
/home/finn/qt/qtbase/lib/libQt5Core.a(qlibrary_unix.o): In function `QLibraryPrivate::load_sys()':
qlibrary_unix.cpp:(.text+0xaac): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lqxcb
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/libpthread.so.0
/home/finn/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/../lib/gcc/arm-linux-gnueabihf/4.8.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libpthread_nonshared.a
collect2: error: ld returned 1 exit status

编辑 2 - 解决方案

我解决了问题并成功编译了 Qt.我需要做的就是重新安装 Ubuntu.这肯定不是一个优雅的解决方案,但它对我有用.

Edit 2 - Solution

I fixed the problem and successfully compiled Qt. All I needed to do was reinstall Ubuntu. It sure isn't an elegant solution but it works for me.

推荐答案

libm.a(mpa.o): 重定位 R_ARM_THM_MOVW_ABS_NC 在创建共享对象时不能使用本地符号"

libm.a(mpa.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object

翻译:您试图将非-fPIC 编译的目标文件(mpa.o from libm.a)链接到共享的图书馆.你不能那样做.

Translation: you are trying to link non--fPIC compiled object file (mpa.o from libm.a) into a shared library. You can't do that.

您需要为您的目标找到/安装 libm.so,或者将 qt5 配置为不构建共享库(可能使用 --disable-shared 选项).

You need to either find/install libm.so for your target, or configure qt5 to not build shared library (possibly with --disable-shared option).

这篇关于为 Nitrogen6x 构建 Qt 5 时出现 Libm 重定位错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆