Question

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

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

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

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

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.

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

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 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?

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

Edit

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

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.

Was it helpful?

Solution 2

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).

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top