I’m working on cross-complie qt5 for BBB. Here is what I’ve already done for this work:
- 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.
- I built sgx driver and installed on the target. (Qt needs this driver for opengl)
- 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
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:
- 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?
- How to modify the default include path and library path for cross-compiler so it exludes /media/XXX/rootfs/usr/include/arm-linux-gnueabihf?
- 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!