Cross-compile Qt5 for BBB: include path and lib path

Hello everyone,

I’m working on cross-complie qt5 for BBB. Here is what I’ve already done for this work:

  1. I built a sd-card based on Robert C. Nelson’s eewiki website. (https://eewiki.net/display/linuxonarm/BeagleBone+Black)
    I use gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf for compiler.
  2. I built sgx driver and installed on the target. (Qt needs this driver for opengl)
  3. I downloaded qt-everywhere-opensource-src-5.7 and configured it with -sysroot=/media/XXX/rootfs, which is my sd-card mount dir. And the configure passed without errors.

However, when I run “make”, there errors like “double log(double), ambiguous function”.

I checked cross-toolchain’s default include path and lib path, it includes both host’s path and target’s path.
For example, my toolchain is in /home/XXX/ARM/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf, and the default include path will be

/home/XXX/ARM/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include <--------- headers on host


/media/XXX/rootfs/usr/include/arm-linux-gnueabihf <---------- headers on target
/media/XXX/rootfs/usr/include

It looks when cross compiling Qt source, toolchain searches sysroot’s include path first, but headers and library on host differs from those on target’s file system. So, the compiler actually uses some of the library on host and some of the library on target, which results in a lot of errors.

I tried copying all the files in /home/XXX/ARM/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc to target sysroot, but no help. The compiler still searches /media/XXX/rootfs/usr/include/arm-linux-gnueabihf and results in errors.
I tried removing arm-linux-gnueabihf on target (delete /lib/arm-linux-gnueabihf, /usr/lib/arm-linux-gnueabihf and /usr/include/arm-linux-gnueabihf), but the system can’t boot anymore.

So, my questions are:

  1. How can I install gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf’s library and headers on target file system to replace the old one?
  2. How to modify the default include path and library path for cross-compiler so it exludes /media/XXX/rootfs/usr/include/arm-linux-gnueabihf?
  3. How to modify the executable on target so it searches specific dl path (.so files)?

Sorry for my poor English, hope someone can understand what I say. Thanks!

Yang

Yang, hello.
If youare still interesting in your theme, welcome.
https://groups.google.com/d/msg/beagleboard/zvzjtzLGOcc/3oOIx2ecCQAJ
I have a full worked Qt5.7 + QtQuick2 on bbb.
Good luck.