Libm relocation error when building Qt 5 for Nitrogen6x

只谈情不闲聊 提交于 2019-12-06 06:49:15

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

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.

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

Psy-Kai

A litte late, but I found the problem/solution:

The problem is the sysroot. Normally gcc links to shared libraries. But when it cant find it, gcc uses the static libraries (.a). When you look in [sysroot]/usr/lib/arm-linux-gnueabihf the shared libraries are not in this place. There are only symlinks to /lib/arm-linux-gnueabihf. So gcc looks for the shared libraries on you host-pc, where it can not find them.

Solution

Create just the right symlink. (Here's an example for libglib, the X is the version number)

ln -s [sysroot]/lib/arm-linux-gnueabihf/libglib.so.X \
      [sysroot]/usr/lib/arm-linux-gnueabihf/libglib.so

(Dont forget to remove the old symlink and create it after compiling successfully; i just do the following before compiling:

mv file.so file.so.backup

another solution

Another solution is to change the absolut symlinks to relative ones. For Example, if your library is /lib/arm-linux-gnueabihf/libglib.so.X and you need a link in /usr/lib/arm-linux-gnueabihf/, you just do:

ln -s ../../../lib/arm-linux-gnueabihf/libglib.so.X \
      [sysroot]/usr/lib/arm-linux-gnueabihf/libglib.so
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!