Cross compile ARM
-
Hello,
i'm trying to compile my Hello World program from my Ubuntu (18.04) VM for my STM32MP157C-DK2 board.
The board contains Qt 5.11.2 libraries. Therefore I installed qt-everywhere-src-5.11.2 and gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf on my VM.
I created a folder here:
"~/qt-everywhere-src-5.11.2/qtbase/mkspecs/devices/stm32"The qmake.conf looks like this:
# # Generic qmake configuration for building with g++ on generic devices. # # A minimal configure line could look something like this: # ./configure -device stm32 -device-option CROSS_COMPILE=mipsel-linux-gnu- include(../common/linux_device_pre.conf) include(../common/linux_device_post.conf) # modifications to g++.conf QMAKE_CC = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc QMAKE_CXX = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ QMAKE_LINK = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ QMAKE_LINK_SHLIB = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ # modifications to linux.conf QMAKE_AR = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar cqs QMAKE_OBJCOPY = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objcopy QMAKE_NM = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -P QMAKE_STRIP = /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip load(qt_config)
Then I try to create the qmake file with the following command:
./configure -opensource -confirm-license -release -device stm32 -device-option CROSS_COMPILE=/home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /home/myuser/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi -prefix /usr/local/Qt-5.11.2-arm
Sysroot is from the offical STM SDK.
I have already created the GTK project as described in this tutorial and it runs perfectly on the board.This tutorial describes how cross compile to ARM with Qt 4.8 works but I need a qmake for Qt 5.11.2. I did this tutorial successfull but the application did not start because of wrong version.
I run the upper ./configure command successfull and then id did make.
Its starting to build but after a short time I get following errors:
/home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/bin/ld.gold: error: .obj/thread_utils.o: incompatible target /home/myuser/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.4.1/../../../../arm-linux-gnueabihf/bin/ld.gold: error: .obj/utils.o: incompatible target .obj/alpha_processing_neon.o:alpha_processing_neon.c:function WebPInitAlphaProcessingNEON: error: undefined reference to 'WebPApplyAlphaMultiply' .obj/alpha_processing_neon.o:alpha_processing_neon.c:function WebPInitAlphaProcessingNEON: error: undefined reference to 'WebPDispatchAlpha' .obj/alpha_processing_neon.o:alpha_processing_neon.c:function WebPInitAlphaProcessingNEON: error: undefined reference to 'WebPDispatchAlphaToGreen' .obj/alpha_processing_neon.o:alpha_processing_neon.c:function WebPInitAlphaProcessingNEON: error: undefined reference to 'WebPExtractAlpha' .obj/alpha_processing_neon.o:alpha_processing_neon.c:function WebPInitAlphaProcessingNEON: error: undefined reference to 'WebPExtractGreen' .obj/dec_neon.o:dec_neon.c:function VP8DspInitNEON: error: undefined reference to 'VP8Transform' .obj/dec_neon.o:dec_neon.c:function VP8DspInitNEON: error: undefined reference to 'VP8PredLuma16' .obj/dec_neon.o:dec_neon.c:function VP8DspInitNEON: error: undefined reference to 'VP8PredChroma8' .obj/enc_neon.o:enc_neon.c:function CollectHistogram_NEON: error: undefined reference to 'VP8SetHistogramData' .obj/enc_neon.o:enc_neon.c:function CollectHistogram_NEON: error: undefined reference to 'VP8DspScan' .obj/enc_neon.o:enc_neon.c:function VP8EncDspInitNEON: error: undefined reference to 'VP8ITransform' .obj/enc_neon.o:enc_neon.c:function VP8EncDspInitNEON: error: undefined reference to 'VP8FTransform' .obj/enc_neon.o:enc_neon.c:function VP8EncDspInitNEON: error: undefined reference to 'VP8EncQuantizeBlock' .obj/enc_neon.o:enc_neon.c:function VP8EncDspInitNEON: error: undefined reference to 'VP8EncQuantize2Blocks' .obj/filters_neon.o:filters_neon.c:function VP8FiltersInitNEON: error: undefined reference to 'WebPUnfilters' .obj/filters_neon.o:filters_neon.c:function VP8FiltersInitNEON: error: undefined reference to 'WebPFilters' .obj/lossless_enc_neon.o:lossless_enc_neon.c:function TransformColor_NEON: error: undefined reference to 'VP8LTransformColor_C' .obj/lossless_enc_neon.o:lossless_enc_neon.c:function VP8LEncDspInitNEON: error: undefined reference to 'VP8LSubtractGreenFromBlueAndRed' .obj/lossless_enc_neon.o:lossless_enc_neon.c:function VP8LEncDspInitNEON: error: undefined reference to 'VP8LTransformColor' .obj/lossless_enc_neon.o:lossless_enc_neon.c:function SubtractGreenFromBlueAndRed_NEON: error: undefined reference to 'VP8LSubtractGreenFromBlueAndRed_C' .obj/lossless_neon.o:lossless_neon.c:function TransformColorInverse_NEON: error: undefined reference to 'VP8LTransformColorInverse_C' .obj/lossless_neon.o:lossless_neon.c:function PredictorAdd0_NEON: error: undefined reference to 'VP8LPredictorsAdd_C' .obj/lossless_neon.o:lossless_neon.c:function PredictorAdd2_NEON: error: undefined reference to 'VP8LPredictorsAdd_C' .obj/lossless_neon.o:lossless_neon.c:function PredictorAdd3_NEON: error: undefined reference to 'VP8LPredictorsAdd_C' .obj/lossless_neon.o:lossless_neon.c:function PredictorAdd4_NEON: error: undefined reference to 'VP8LPredictorsAdd_C' .obj/lossless_neon.o:lossless_neon.c:function VP8LDspInitNEON: error: undefined reference to 'VP8LPredictors' .obj/lossless_neon.o:lossless_neon.c:function VP8LDspInitNEON: error: undefined reference to 'VP8LPredictorsAdd' .obj/lossless_neon.o:lossless_neon.c:function VP8LDspInitNEON: error: undefined reference to 'VP8LConvertBGRAToRGBA' .obj/lossless_neon.o:lossless_neon.c:function VP8LDspInitNEON: error: undefined reference to 'VP8LConvertBGRAToBGR' .obj/lossless_neon.o:lossless_neon.c:function VP8LDspInitNEON: error: undefined reference to 'VP8LConvertBGRAToRGB' .obj/lossless_neon.o:lossless_neon.c:function VP8LDspInitNEON: error: undefined reference to 'VP8LAddGreenToBlueAndRed' .obj/lossless_neon.o:lossless_neon.c:function VP8LDspInitNEON: error: undefined reference to 'VP8LTransformColorInverse' .obj/lossless_neon.o:lossless_neon.c:function AddGreenToBlueAndRed_NEON: error: undefined reference to 'VP8LAddGreenToBlueAndRed_C' .obj/lossless_neon.o:lossless_neon.c:function ConvertBGRAToRGB_NEON: error: undefined reference to 'VP8LConvertBGRAToRGB_C' .obj/lossless_neon.o:lossless_neon.c:function ConvertBGRAToBGR_NEON: error: undefined reference to 'VP8LConvertBGRAToBGR_C' .obj/lossless_neon.o:lossless_neon.c:function ConvertBGRAToRGBA_NEON: error: undefined reference to 'VP8LConvertBGRAToRGBA_C' .obj/rescaler_neon.o:rescaler_neon.c:function WebPRescalerDspInitNEON: error: undefined reference to 'WebPRescalerExportRowExpand' .obj/rescaler_neon.o:rescaler_neon.c:function WebPRescalerDspInitNEON: error: undefined reference to 'WebPRescalerExportRowShrink' .obj/upsampling_neon.o:upsampling_neon.c:function WebPInitUpsamplersNEON: error: undefined reference to 'WebPUpsamplers' .obj/yuv_neon.o:yuv_neon.c:function WebPInitConvertARGBToYUVNEON: error: undefined reference to 'WebPConvertRGB24ToY' .obj/yuv_neon.o:yuv_neon.c:function WebPInitConvertARGBToYUVNEON: error: undefined reference to 'WebPConvertBGR24ToY' .obj/yuv_neon.o:yuv_neon.c:function WebPInitConvertARGBToYUVNEON: error: undefined reference to 'WebPConvertARGBToY' .obj/yuv_neon.o:yuv_neon.c:function WebPInitConvertARGBToYUVNEON: error: undefined reference to 'WebPConvertARGBToUV' .obj/yuv_neon.o:yuv_neon.c:function WebPInitConvertARGBToYUVNEON: error: undefined reference to 'WebPConvertRGBA32ToUV' .obj/yuv_neon.o:yuv_neon.c:function WebPInitSharpYUVNEON: error: undefined reference to 'WebPSharpYUVUpdateY' .obj/yuv_neon.o:yuv_neon.c:function WebPInitSharpYUVNEON: error: undefined reference to 'WebPSharpYUVUpdateRGB' .obj/yuv_neon.o:yuv_neon.c:function WebPInitSharpYUVNEON: error: undefined reference to 'WebPSharpYUVFilterRow' .obj/yuv_neon.o:yuv_neon.c:function ConvertARGBToUV_NEON: error: undefined reference to 'WebPConvertARGBToUV_C' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::~QWebpHandler(): error: undefined reference to 'WebPDemuxReleaseIterator' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::~QWebpHandler(): error: undefined reference to 'WebPDemuxDelete' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::ensureDemuxer() [clone .part.8]: error: undefined reference to 'WebPDemuxInternal' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::ensureScanned() const [clone .part.9]: error: undefined reference to 'WebPGetFeaturesInternal' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::ensureScanned() const [clone .part.9]: error: undefined reference to 'WebPDemuxGetI' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::ensureScanned() const [clone .part.9]: error: undefined reference to 'WebPDemuxGetI' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::ensureScanned() const [clone .part.9]: error: undefined reference to 'WebPDemuxGetI' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::read(QImage*): error: undefined reference to 'WebPDemuxGetFrame' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::read(QImage*): error: undefined reference to 'WebPGetFeaturesInternal' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::read(QImage*): error: undefined reference to 'WebPDecodeBGRAInto' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::read(QImage*): error: undefined reference to 'WebPDemuxNextFrame' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::write(QImage const&) [clone .part.16]: error: undefined reference to 'WebPPictureInitInternal' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::write(QImage const&) [clone .part.16]: error: undefined reference to 'WebPConfigInitInternal' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::write(QImage const&) [clone .part.16]: error: undefined reference to 'WebPPictureImportBGRA' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::write(QImage const&) [clone .part.16]: error: undefined reference to 'WebPEncode' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::write(QImage const&) [clone .part.16]: error: undefined reference to 'WebPPictureFree' .obj/qwebphandler.o:qwebphandler.cpp:function QWebpHandler::write(QImage const&) [clone .part.16]: error: undefined reference to 'WebPPictureFree' collect2: error: ld returned 1 exit status Makefile:402: recipe for target '../../../../plugins/imageformats/libqwebp.so' failed make[5]: *** [../../../../plugins/imageformats/libqwebp.so] Error 1 make[5]: Leaving directory '/home/myuser/qt-everywhere-src-5.11.2/qtimageformats/src/plugins/imageformats/webp' Makefile:123: recipe for target 'sub-webp-make_first' failed make[4]: *** [sub-webp-make_first] Error 2 make[4]: Leaving directory '/home/myuser/qt-everywhere-src-5.11.2/qtimageformats/src/plugins/imageformats' Makefile:44: recipe for target 'sub-imageformats-make_first' failed make[3]: *** [sub-imageformats-make_first] Error 2 make[3]: Leaving directory '/home/myuser/qt-everywhere-src-5.11.2/qtimageformats/src/plugins' Makefile:45: recipe for target 'sub-plugins-make_first' failed make[2]: *** [sub-plugins-make_first] Error 2 make[2]: Leaving directory '/home/myuser/qt-everywhere-src-5.11.2/qtimageformats/src' Makefile:45: recipe for target 'sub-src-make_first' failed make[1]: *** [sub-src-make_first] Error 2 make[1]: Leaving directory '/home/myuser/qt-everywhere-src-5.11.2/qtimageformats' Makefile:258: recipe for target 'module-qtimageformats-make_first' failed make: *** [module-qtimageformats-make_first] Error 2
I'd be happy if someone could help me fix this.
Thank you in advance -
I fixed it! My qmake.conf was correct but I was missing a configuration option. Now my configuration looks lit this:
~/qt-everywhere-src-5.11.2//configure -opensource -confirm-license -release -device stm32mp1 -device-option CROSS_COMPILE=~/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot ~/STM32MPU_workspace/STM32MP15-Ecosystem-v1.0.0/Developer-Package/SDK/sysroots/cortexa7t2hf-neon-vfpv4-openstlinux_weston-linux-gnueabi -skip qtwebengine -prefix /usr/local/Qt-5.11.2-arm -nomake examples -nomake tests -opengl es2