Qt 5.4.2 Cross compile with sysroot
-
Hello,
I am trying to cross compile the Qt 5.4 for the freescale i.Mx6 platform on a x86_64 system.The configuration of the frame work is done by the following configuration command:
./configure -v
-opensource -confirm-license -make libs -shared -xplatform linux-g++ -device linux-imx6-g++
-device-option CROSS_COMPILE=/opt/yocto/1.6.4/armv7a/sysroots/x86_64-sdk-linux/usr/bin/arm-linux-gnueabi/arm-linux-gnueabi-
-no-xcb
-device-option DISTRO_OPTS=hard-float
-sysroot $SDKTARGETSYSROOT
-prefix $SDKTARGETSYSROOT
-extprefix $SDKTARGETSYSROOTThe configuration script successfully finishes.
However gmake fails, because the sysroot parameter is also append to the host gcc compiler and not only to the gcc cross compiler.
Therefore compiling qtbase-opensource-src-5.4.1/src/tools/bootstrap for the host system fails:
g++ -c -O2 -pipe -g -feliminate-unused-debug-types --sysroot=/opt/yocto/1.6.4/armv7a/sysroots/cortexa9hf-vfp-neon-linux-gnueabi -ffunction-sections -O2 -fPIC -std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -DQT_NO_MTDEV -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NO_TRANSLATION -DQT_QMAKE_LOCATION="/home/mark/projects/20150602_linux_mod_s203/linux/app/gui/qt/qtbase/qtbase-opensource-src-5.4.1/bin/qmake" -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_NO_CAST_FROM_ASCII -DQT_BUILD_BOOTSTRAP_LIB -DQT_BUILDING_QT -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -I. -I../../3rdparty/zlib -I../../../include -I../../../include/QtCore -I../../../include/QtXml -I../../../include/QtCore/5.4.2 -I../../../include/QtCore/5.4.2/QtCore -I../../../include/QtXml/5.4.2 -I../../../include/QtXml/5.4.2/QtXml -I../../../mkspecs/linux-g++ -o .obj/qlatincodec.o ../../corelib/codecs/qlatincodec.cpp
In file included from /opt/yocto/1.6.4/armv7a/sysroots/cortexa9hf-vfp-neon-linux-gnueabi/usr/include/features.h:402:0,
from /usr/include/c++/4.8/x86_64-suse-linux/bits/os_defines.h:39,
from /usr/include/c++/4.8/x86_64-suse-linux/bits/c++config.h:430,
from /usr/include/c++/4.8/utility:68,
from ../../../include/QtCore/../../src/corelib/global/qcompilerdetection.h:890,
from ../../../include/QtCore/qcompilerdetection.h:1,
from ../../../include/QtCore/../../src/corelib/global/qglobal.h:70,
from ../../../include/QtCore/qglobal.h:1,
from ../../../include/QtCore/../../src/corelib/tools/qchar.h:37,
from ../../../include/QtCore/qchar.h:1,
from ../../../include/QtCore/../../src/corelib/tools/qstring.h:37,
from ../../../include/QtCore/qstring.h:1,
from ../../../include/QtCore/../../src/corelib/codecs/qtextcodec.h:37,
from ../../../include/QtCore/qtextcodec.h:1,
from ../../corelib/codecs/qlatincodec_p.h:48,
from ../../corelib/codecs/qlatincodec.cpp:34:
/opt/yocto/1.6.4/armv7a/sysroots/cortexa9hf-vfp-neon-linux-gnueabi/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory
#include <gnu/stubs-soft.h>If I remove the sysroot option in the qtbase-opensource-src-5.4.1/src/tools/bootstrap/Makefile file. The object is built.
Has anybody an idea , how I can prevent the failure?
Is this a bug in the configuration script?Best wishes
Mark78
-
Try adding the -platform flag for the host platform.
-
I have set the "-xplatform linux-g++" option, is the "-platform" option also necessary?
-
I'm just taking a guess. That's the only missing thing I can see in your configuration line. I have also cross compiled Qt using -sysroot e didn't have this problem. -platform specifies the specs for the host platform. -xplatform specifies the specs for the target platform.
-
Many thanks, I will try it tomorrow.
Mark78
-
Sorry, but it does not work for me.
The reason were the CC, CXX, CPP, LD, RANLIB, CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS variables, which were set to my cross compiler environment. If I remove these exports, the cross compiling works fine.
Mark78