Solved Unable to cross compile Qt5.12.3 for Armv7
-
I have been trying to cross compile Qt for an Armv7 device and have been hitting the following error:
/home/scorpion/Qt_Source/qt-everywhere-src-5.12.3/qtbase/bin/rcc -name qpdf painting/qpdf.qrc -o .rcc/qrc_qpdf.cpp /home/scorpion/Qt_Source/qt-everywhere-src-5.12.3/qtbase/bin/rcc -name qmake_webgradients .rcc/qmake_webgradients.qrc -o .rcc/qrc_qmake_webgradients.cpp /usr/bin/arm-linux-gnueabihf-gcc -c -include .pch/Qt5Gui -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mthumb -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mthumb -mfloat-abi=hard --sysroot=/mnt/Smartlog-rootfs -O3 -std=gnu11 -fvisibility=hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DENABLE_PIXMAN_DRAWHELPERS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_GUI_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -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 -DQT_CORE_LIB -I. -I../../include -I../../include/QtGui -I../../include/QtGui/5.12.3 -I../../include/QtGui/5.12.3/QtGui -I.tracegen -I/usr/include -I../../include/QtCore/5.12.3 -I../../include/QtCore/5.12.3/QtCore -I../../include/QtCore -I.moc -isystem /mnt/Smartlog-rootfs/usr/include/libpng16 -I../3rdparty/harfbuzz-ng/include -I../../mkspecs/devices/linux-cm-t3730-g++ -o .obj/qgrayraster.o painting/qgrayraster.c In file included from /usr/arm-linux-gnueabihf/include/stdlib.h:55:0, from /usr/arm-linux-gnueabihf/include/c++/7/cstdlib:75, from /usr/arm-linux-gnueabihf/include/c++/7/bits/stl_algo.h:59, from /usr/arm-linux-gnueabihf/include/c++/7/algorithm:62, from ../../include/QtCore/../../src/corelib/global/qglobal.h:142, from ../../include/QtCore/qglobal.h:1, from ../../include/QtGui/../../src/gui/kernel/qtguiglobal.h:43, from ../../include/QtGui/qtguiglobal.h:1, from kernel/qt_gui_pch.h:50: /usr/include/bits/floatn.h:75:70: error: unknown machine mode ‘__TC__’ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); ^ /usr/include/bits/floatn.h:87:9: error: ‘__float128’ does not name a type; did you mean ‘__cfloat128’? typedef __float128 _Float128; ^~~~~~~~~~ __cfloat128 In file included from /usr/arm-linux-gnueabihf/include/c++/7/cstdlib:75:0, from /usr/arm-linux-gnueabihf/include/c++/7/bits/stl_algo.h:59, from /usr/arm-linux-gnueabihf/include/c++/7/algorithm:62, from ../../include/QtCore/../../src/corelib/global/qglobal.h:142, from ../../include/QtCore/qglobal.h:1, from ../../include/QtGui/../../src/gui/kernel/qtguiglobal.h:43, from ../../include/QtGui/qtguiglobal.h:1, from kernel/qt_gui_pch.h:50: /usr/arm-linux-gnueabihf/include/stdlib.h:152:8: error: ‘_Float128’ does not name a type; did you mean ‘_Float32x’? extern _Float128 strtof128 (const char *__restrict __nptr, ^~~~~~~~~ _Float32x /usr/arm-linux-gnueabihf/include/stdlib.h:245:4: error: ‘_Float128’ has not been declared _Float128 __f) ^~~~~~~~~ In file included from /usr/arm-linux-gnueabihf/include/c++/7/cstdlib:75:0, from /usr/arm-linux-gnueabihf/include/c++/7/bits/stl_algo.h:59, from /usr/arm-linux-gnueabihf/include/c++/7/algorithm:62, from ../../include/QtCore/../../src/corelib/global/qglobal.h:142, from ../../include/QtCore/qglobal.h:1, from ../../include/QtGui/../../src/gui/kernel/qtguiglobal.h:43, from ../../include/QtGui/qtguiglobal.h:1, from kernel/qt_gui_pch.h:50: /usr/arm-linux-gnueabihf/include/stdlib.h:330:8: error: ‘_Float128’ does not name a type; did you mean ‘_Float32x’? extern _Float128 strtof128_l (const char *__restrict __nptr,
From what I can tell, it seems the the issue is because the compiler is trying to use the floatn.h file in my host root folder, instead of the one in my sysroot folder (located at /mnt/Smartlog-rootfs/usr/include/arm-linux-gnueabihf/bits/floatn.h)
I have been following the following guide https://doc.qt.io/qt-5/embedded-linux.html and making modifications to match my board configuration, so I'm not sure what I'm missing.
Here is my configuration command:
./configure -release -opengl es2 -device linux-cm-t3730-g++ -device-option CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -sysroot /mnt/Smartlog-rootfs -prefix /usr/local/qt5-SLL -opensource -confirm-license -no-use-gold-linker -no-pkg-config -recheck-all -no-openssl
This is what I have in my .conf file
MAKEFILE_GENERATOR = UNIX CONFIG += incremental QMAKE_INCREMENTAL_STYLE = sublib include(../../common/linux.conf) include(../../common/gcc-base-unix.conf) include(../../common/g++-unix.conf) load(device_config) QT_QPA_DEFAULT_PLATFORM = eglfs # modifications to g++.conf QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} QMAKE_LINK_SHLIB = $${QMAKE_CXX} # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip COMPILER_FLAGS = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mthumb #modifications to gcc-base.conf QMAKE_CFLAGS += $${COMPILER_FLAGS} QMAKE_CXXFLAGS += $${COMPILER_FLAGS} QMAKE_CXXFLAGS_RELEASE += -O3 QMAKE_LIBS += -lrt -lpthread -ldl # Extra stuff (OpenGL, DirectFB, ...) QMAKE_LIBDIR_EGL = $${QT_SYSROOT}/usr/lib QMAKE_LIBDIR_OPENGL_ES2 = $${QMAKE_LIBDIR_EGL} QMAKE_INCDIR_EGL = $${QT_SYSROOT}/usr/include QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL} QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL} QMAKE_LIBDIR_OPENVG = $${QMAKE_LIBDIR_EGL} QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $${QMAKE_LIBS_EGL} QMAKE_LIBS_OPENVG = -lOpenVG $${QMAKE_LIBS_EGL} DISTRO_OPTS += hard-float # No need for any special EGL device integration. # Prioritize the default, compiled-in integration over any plugins. EGLFS_DEVICE_INTEGRATION = none include(../common/linux_arm_device_post.conf) load(qt_config)
-
@Kelsey Hi. Is there any chance that configuration of your toolchain is not correct?
Try to use following bash-script as examples: ToolChain setup and Qt config. -
@r3d9u11 I've tried using your scripts but I'm not sure I completely understand how to use them. I tried to make modifications to get them to work with my board configuration but I've still had no luck. I've also tried setting up a fresh sysroot folder and reinstalling my toolchain, but I'm still hitting the same problem.
Would this imply that the issue is with my configuration file?
-
I was able to figure this out with more testing. I noticed that if I configured with the -no-opengl option I was able to compile/install without errors.
This led me to looking into my .conf file to make sure I had my paths setup correctly. I used this configure input
./configure -release -opengl es2 -device linux-beagleboard-g++ -device-option CROSS_COMPILE=/opt/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/Smartlog-rootfs -opensource -confirm-license -make libs -no-use-gold-linker -prefix /usr/local/qt5-SLL -extprefix /home/scorpion/Qt_Source/Qt_Installed/Qt_5.11.3_Beagleboard -skip qtserialbus -skip qtscxml -skip qtscript -skip qtcharts -skip qt3d -skip qtdatavis3d -skip qtcanvas3d -skip qtgamepad -skip qtvirtualkeyboard -skipqtwayland -skip qtwebengine -skip qtwebchannel -skip qtwebglplugin -qt-zlib -recheck-all
and this .conf file
MAKEFILE_GENERATOR = UNIX CONFIG += incremental QMAKE_INCREMENTAL_STYLE = sublib QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/lib/arm-linux-gnueabihf include(../../common/linux.conf) include(../../common/gcc-base-unix.conf) include(../../common/g++-unix.conf) load(device_config) QT_QPA_DEFAULT_PLATFORM = eglfs # modifications to g++.conf QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} QMAKE_LINK_SHLIB = $${QMAKE_CXX} # modifications to linux.conf QMAKE_AR = $${CROSS_COMPILE}ar cqs QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip COMPILER_FLAGS = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mthumb #modifications to gcc-base.conf QMAKE_CFLAGS += $${COMPILER_FLAGS} QMAKE_CXXFLAGS += $${COMPILER_FLAGS} QMAKE_CXXFLAGS_RELEASE += -O3 QMAKE_LIBS += -lrt -lpthread -ldl # Extra stuff (OpenGL, DirectFB, ...) QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/usr/include/EGL QMAKE_LIBDIR_EGL = $$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL} QMAKE_LIBDIR_OPENGL_ES2 = $${QMAKE_LIBDIR_EGL} QMAKE_INCDIR_OPENVG = $${QMAKE_INCDIR_EGL} QMAKE_LIBDIR_OPENVG = $${QMAKE_LIBDIR_EGL} QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $${QMAKE_LIBS_EGL} QMAKE_LIBS_OPENVG = -lOpenVG $${QMAKE_LIBS_EGL} DISTRO_OPTS += hard-float # No need for any special EGL device integration. # Prioritize the default, compiled-in integration over any plugins. EGLFS_DEVICE_INTEGRATION = none include(../common/linux_arm_device_post.conf) load(qt_config)
With these changes I was able to compile without errors and everything seems to be running as intended.