Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building static Qt for embedded devices (cross-compile) fails
Forum Updated to NodeBB v4.3 + New Features

Building static Qt for embedded devices (cross-compile) fails

Scheduled Pinned Locked Moved Solved Installation and Deployment
18 Posts 3 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    You should also pass the sysroot option and point it to the sysroot of your device in order for configure to find the dependencies for the correct platform.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    M 1 Reply Last reply
    1
    • SGaistS SGaist

      Hi,

      You should also pass the sysroot option and point it to the sysroot of your device in order for configure to find the dependencies for the correct platform.

      M Offline
      M Offline
      mjohn
      wrote on last edited by
      #3

      Hi @SGaist

      I do pass the -sysroot option:

      -sysroot /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/
      
      MijazM 1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        I just realised: make: Nothing to be done for 'first'. Are you cross-compiling from a clean state ? It doesn't look like it.

        One recommandation: use out of source builds. This way you don't have to clean the sources between two builds and if something goes wrong, you can simply nuke the folder and start fresh.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        M 1 Reply Last reply
        0
        • SGaistS SGaist

          I just realised: make: Nothing to be done for 'first'. Are you cross-compiling from a clean state ? It doesn't look like it.

          One recommandation: use out of source builds. This way you don't have to clean the sources between two builds and if something goes wrong, you can simply nuke the folder and start fresh.

          M Offline
          M Offline
          mjohn
          wrote on last edited by mjohn
          #5

          Hi @SGaist

          I've deleted the directory and started the build over. This time it build qmake successfully but still fails at the same spot, but with a different error. This time the machine tuple check succeeded, but still thinks the toolchain or QMakeSpec is broken. Again this same toolchain successfully builds Qt 5.9.

          Running configuration tests...
          Checking for machine tuple... 
          + /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++ -dumpmachine
          > arm-linux-gnueabihf
          test config.qtbase.tests.machineTuple succeeded
          Checking for valid makespec... 
          + cd /home/dlogic/qt-everywhere-src-5.13.0/config.tests/verifyspec && /home/dlogic/qt-everywhere-src-5.13.0/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/" "QMAKE_CXXFLAGS += --sysroot=/home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/" "QMAKE_LFLAGS += --sysroot=/home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/" -early "CONFIG += cross_compile" /home/dlogic/qt-everywhere-src-5.13.0/qtbase/config.tests/verifyspec
          + cd /home/dlogic/qt-everywhere-src-5.13.0/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make
          > /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard --sysroot=/home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/ -O2 -w -fPIC  -I/home/dlogic/qt-everywhere-src-5.13.0/qtbase/config.tests/verifyspec -I. -I/home/dlogic/qt-everywhere-src-5.13.0/qtbase/mkspecs/devices/linux-imx6-g++ -o verifyspec.o /home/dlogic/qt-everywhere-src-5.13.0/qtbase/config.tests/verifyspec/verifyspec.cpp
          > Assembler messages:
          > Fatal error: invalid -march= option: `armv7-a'
          > Makefile:180: recipe for target 'verifyspec.o' failed
          > make: *** [verifyspec.o] Error 2
          Note: Also available for Linux: linux-clang linux-icc
          
          ERROR: Cannot compile a minimal program. The toolchain or QMakeSpec is broken.
          

          Also the GCC cross-compiler is version 6.3.0

          $ /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++ --version
          arm-linux-gnueabihf-g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
          Copyright (C) 2016 Free Software Foundation, Inc.
          This is free software; see the source for copying conditions.  There is NO
          warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
          
          
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @mjohn said in Building static Qt for embedded devices (cross-compile) fails:

            armv7-a

            Did you try running arm-linux-gnueabihf-g++ -march=armv7-a

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply
            0
            • SGaistS SGaist

              @mjohn said in Building static Qt for embedded devices (cross-compile) fails:

              armv7-a

              Did you try running arm-linux-gnueabihf-g++ -march=armv7-a

              M Offline
              M Offline
              mjohn
              wrote on last edited by
              #7

              Hi @SGaist

              Yes, and it seems to accept the option:

              $ arm-linux-gnueabihf-g++ -march=armv7-a
              arm-linux-gnueabihf-g++: fatal error: no input files
              compilation terminated.
              
              $ cat /tmp/test.c
              #include <stdio.h>
              
              int main(void) {
                  return 0;
              }
              $ arm-linux-gnueabihf-g++ -march=armv7-a /tmp/test.c
              $ echo $?
              0
              
              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @mjohn said in Building static Qt for embedded devices (cross-compile) fails:

                /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++

                Might be a silly question but are you sure that this is the one you are currently calling when doing just "arm-linux-gnueabihf-g++" ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                M 1 Reply Last reply
                0
                • SGaistS SGaist

                  @mjohn said in Building static Qt for embedded devices (cross-compile) fails:

                  /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++

                  Might be a silly question but are you sure that this is the one you are currently calling when doing just "arm-linux-gnueabihf-g++" ?

                  M Offline
                  M Offline
                  mjohn
                  wrote on last edited by
                  #9

                  Hi @SGaist

                  Not a silly question, turns out it was not!
                  Now when I use the full path to ensure I'm using the expected compiler I get the same 'invalid option' error. So for some reason my cross compiler doesn't support the board?

                  $ /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++ -march=armv7-a /tmp/test.c -I /home/dlogic/Development/fs/debian/dl-dm-x/debian-stretch-armhf-eglfb_imx-viv_dlogic-dm-dev/usr/include/arm-linux-gnueabihf/
                  Assembler messages:
                  Fatal error: invalid -march= option: `armv7-a'
                  
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Can you print which version of g++ this one is ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Can you print which version of g++ this one is ?

                      M Offline
                      M Offline
                      mjohn
                      wrote on last edited by
                      #11

                      Hi @SGaist

                      GCC version 6.3.0

                      dlogic@dlogic-vm:~/qt-everywhere-src-5.13.0$ /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++ --version
                      arm-linux-gnueabihf-g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
                      Copyright (C) 2016 Free Software Foundation, Inc.
                      This is free software; see the source for copying conditions.  There is NO
                      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
                      
                      dlogic@dlogic-vm:~/qt-everywhere-src-5.13.0$ arm-linux-gnueabihf-g++ --version
                      arm-linux-gnueabihf-g++ (Debian 6.3.0-18) 6.3.0 20170516
                      Copyright (C) 2016 Free Software Foundation, Inc.
                      This is free software; see the source for copying conditions.  There is NO
                      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
                      
                      
                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        Strange... Looks like it's recent enough.

                        What does the --target-help option return ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        M 1 Reply Last reply
                        1
                        • SGaistS SGaist

                          Strange... Looks like it's recent enough.

                          What does the --target-help option return ?

                          M Offline
                          M Offline
                          mjohn
                          wrote on last edited by
                          #13

                          @SGaist

                          Running --target-help below. Strange thing is it prints the error at the very end of this, even though the option was not provided.

                          $ /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/usr/bin/arm-linux-gnueabihf-g++ --target-help
                          The following options are target specific:
                            -mabi=                      Specify an ABI.
                            -mabort-on-noreturn         Generate a call to abort if a noreturn function returns.
                            -mandroid                   Generate code for the Android platform.
                            -mapcs-float                Pass FP arguments in FP registers.
                            -mapcs-frame                Generate APCS conformant stack frames.
                            -mapcs-reentrant            Generate re-entrant, PIC code.
                            -march=                     Specify the name of the target architecture.
                            -marm                       Generate code in 32 bit ARM state.
                            -masm-syntax-unified        Assume unified syntax for inline assembly code.
                            -mbig-endian                Assume target CPU is configured as big endian.
                            -mbionic                    Use Bionic C library.
                            -mcallee-super-interworking Thumb: Assume non-static functions may be called from ARM code.
                            -mcaller-super-interworking Thumb: Assume function pointers may go to non-Thumb aware code.
                            -mcpu=                      Specify the name of the target CPU.
                            -mfix-cortex-m3-ldrd        Avoid overlapping destination and address registers on LDRD instructions that may trigger Cortex-M3 errata.
                            -mfloat-abi=                Specify if floating point hardware should be used.
                            -mfp16-format=              Specify the __fp16 floating-point format.
                            -mfpu=                      Specify the name of the target floating point hardware/format.
                            -mglibc                     Use GNU C library.
                            -mlittle-endian             Assume target CPU is configured as little endian.
                            -mlong-calls                Generate call insns as indirect calls, if necessary.
                            -mmusl                      Use musl C library.
                            -mneon-for-64bits           Use Neon to perform 64-bits operations rather than core registers.
                            -mnew-generic-costs         Use the new generic RTX cost tables if new core-specific cost table not available (transitional).
                            -mold-rtx-costs             Use the old RTX costing tables (transitional).
                            -mpic-data-is-text-relative Assume data segments are relative to text segment.
                            -mpic-register=             Specify the register to be used for PIC addressing.
                            -mpoke-function-name        Store function names in object code.
                            -mprint-tune-info           Print CPU tuning information as comment in assembler file.  This is an option used only for regression testing of the compiler and
                                                        not intended for ordinary use in compiling code.
                            -mrestrict-it               Generate IT blocks appropriate for ARMv8.
                            -msched-prolog              Permit scheduling of a function's prologue sequence.
                            -msingle-pic-base           Do not load the PIC register in function prologues.
                            -mslow-flash-data           Assume loading data from flash is slower than fetching instructions.
                            -mstructure-size-boundary=  Specify the minimum bit alignment of structures.
                            -mthumb                     Generate code for Thumb state.
                            -mthumb-interwork           Support calls between Thumb and ARM instruction sets.
                            -mtls-dialect=              Specify thread local storage scheme.
                            -mtp=                       Specify how to access the thread pointer.
                            -mtpcs-frame                Thumb: Generate (non-leaf) stack frames even if not needed.
                            -mtpcs-leaf-frame           Thumb: Generate (leaf) stack frames even if not needed.
                            -mtune=                     Tune code for the given processor.
                            -muclibc                    Use uClibc C library.
                            -munaligned-access          Enable unaligned word and halfword accesses to packed data.
                            -mvectorize-with-neon-double Use Neon double-word (rather than quad-word) registers for vectorization.
                            -mvectorize-with-neon-quad  Use Neon quad-word (rather than double-word) registers for vectorization.
                            -mword-relocations          Only generate absolute relocations on word sized values.
                          
                            Known ARM ABIs (for use with the -mabi= option):
                              aapcs aapcs-linux apcs-gnu atpcs iwmmxt
                          
                            Known ARM architectures (for use with the -march= option):
                              armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6kz armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m
                              armv7-r armv7e-m armv7ve armv8-a armv8-a+crc armv8.1-a armv8.1-a+crc iwmmxt iwmmxt2 native
                          
                            Known __fp16 formats (for use with the -mfp16-format= option):
                              alternative ieee none
                          
                            Known ARM FPUs (for use with the -mfpu= option):
                              crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8 neon-fp16 neon-vfpv4 vfp vfp3 vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16
                              vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16
                          
                            Valid arguments to -mtp=:
                              auto cp15 soft
                          
                            Known floating-point ABIs (for use with the -mfloat-abi= option):
                              hard soft softfp
                          
                            Known ARM CPUs (for use with the -mcpu= and -mtune= options):
                              arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60
                              arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m
                              arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15
                              cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a32 cortex-a35 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72
                              cortex-a72.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply
                              cortex-m3 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 cortex-r8 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a
                              iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native qdf24xx strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale
                          
                            TLS dialect to use:
                              gnu gnu2
                          
                          Assembler options
                          =================
                          
                          Use "-Wa,OPTION" to pass "OPTION" to the assembler.
                          
                          Assembler messages:
                          Fatal error: invalid -march= option: `armv7-a'
                          
                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            Who did provide you with that cross-toolchain ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            M 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Who did provide you with that cross-toolchain ?

                              M Offline
                              M Offline
                              mjohn
                              wrote on last edited by
                              #15

                              @SGaist

                              From the vendor, DLOGIC. They provided the eval board and a VirtualBox VM with the toolchain included.

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                Then I would recommend asking them about the missing architecture.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                1
                                • M Offline
                                  M Offline
                                  mjohn
                                  wrote on last edited by
                                  #17

                                  I got a new toolchain and was successful in building a static version of Qt.
                                  Thanks for the help @SGaist .

                                  1 Reply Last reply
                                  0
                                  • M mjohn

                                    Hi @SGaist

                                    I do pass the -sysroot option:

                                    -sysroot /home/dlogic/Development/fs/debian-stretch-armhf-rootfs_dl-dm-x/
                                    
                                    MijazM Offline
                                    MijazM Offline
                                    Mijaz
                                    wrote on last edited by
                                    #18

                                    @mjohn
                                    Hi, How did you solved this issue?

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved