Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

RaspberryPi2EGLFS cross compile step 10 got error - Project ERROR: Could not determine target architecture



  • hi there. i m still working on the cross compilation based on the steps here https://wiki.qt.io/RaspberryPi2EGLFS

    my host PC is Linux Debian 9.12, my Pi is Raspberry Pi 3 B+

    at step 10 after i completed these three commands below:

    git clone git://code.qt.io/qt/qtbase.git -b 5.9
    
    cd qtbase
    
    ./configure -release -opengl es2 -device linux-rasp-pi3-vc4-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf- -no-use-gold-linker -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -v
    

    it seems working fine after the third command, but i still got the errors below at the last section:

    ....
    This is the Qt Open Source Edition.
    
    You have already accepted the terms of the Open Source license.
    
    Running configuration tests...
    Checking for machine tuple... 
    + /home/debian9/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -dumpmachine
    > arm-linux-gnueabihf
    test config.qtbase.tests.machineTuple succeeded
    Checking for valid makespec... 
    + cd /home/debian9/raspi/qtbase/config.tests/verifyspec && /home/debian9/raspi/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/debian9/raspi/sysroot" -early "CONFIG += cross_compile" /home/debian9/raspi/qtbase/config.tests/verifyspec
    > Info: creating stash file /home/debian9/raspi/qtbase/config.tests/.qmake.stash
    + cd /home/debian9/raspi/qtbase/config.tests/verifyspec && MAKEFLAGS= /usr/bin/make
    > /home/debian9/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/debian9/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/debian9/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-vc4-g++ -o verifyspec.o verifyspec.cpp
    > /home/debian9/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/debian9/raspi/sysroot -Wl,-O1 -Wl,-rpath-link,/home/debian9/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/debian9/raspi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o    
    test config.qtbase.tests.verifyspec succeeded
    Checking for alloca() in alloca.h... 
    + cd /home/debian9/raspi/qtbase/config.tests/alloca_h && /home/debian9/raspi/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/debian9/raspi/sysroot" -early "CONFIG += cross_compile" /home/debian9/raspi/qtbase/config.tests/alloca_h
    + cd /home/debian9/raspi/qtbase/config.tests/alloca_h && MAKEFLAGS= /usr/bin/make
    > /home/debian9/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/debian9/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/debian9/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-vc4-g++ -o main.o main.cpp
    > main.cpp:2:20: fatal error: alloca.h: No such file or directory
    >  #include <alloca.h>
    >                     ^
    > compilation terminated.
    > Makefile:179: recipe for target 'main.o' failed
    > make: *** [main.o] Error 1
    test config.qtbase.tests.alloca_h FAILED
    Checking for alloca() in malloc.h... 
    + cd /home/debian9/raspi/qtbase/config.tests/alloca_malloc_h && /home/debian9/raspi/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/debian9/raspi/sysroot" -early "CONFIG += cross_compile" /home/debian9/raspi/qtbase/config.tests/alloca_malloc_h
    + cd /home/debian9/raspi/qtbase/config.tests/alloca_malloc_h && MAKEFLAGS= /usr/bin/make
    > /home/debian9/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/debian9/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/debian9/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-vc4-g++ -o main.o main.cpp
    > main.cpp:2:20: fatal error: malloc.h: No such file or directory
    >  #include <malloc.h>
    >                     ^
    > compilation terminated.
    > Makefile:179: recipe for target 'main.o' failed
    > make: *** [main.o] Error 1
    test config.qtbase.tests.alloca_malloc_h FAILED
    Checking for alloca() in stdlib.h... 
    + cd /home/debian9/raspi/qtbase/config.tests/alloca_stdlib_h && /home/debian9/raspi/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/debian9/raspi/sysroot" -early "CONFIG += cross_compile" /home/debian9/raspi/qtbase/config.tests/alloca_stdlib_h
    + cd /home/debian9/raspi/qtbase/config.tests/alloca_stdlib_h && MAKEFLAGS= /usr/bin/make
    > /home/debian9/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/debian9/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/debian9/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-vc4-g++ -o main.o main.cpp
    > main.cpp:2:20: fatal error: stdlib.h: No such file or directory
    >  #include <stdlib.h>
    >                     ^
    > compilation terminated.
    > Makefile:179: recipe for target 'main.o' failed
    > make: *** [main.o] Error 1
    test config.qtbase.tests.alloca_stdlib_h FAILED
    Checking for target architecture... 
    + cd /home/debian9/raspi/qtbase/config.tests/arch && /home/debian9/raspi/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_CFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_CXXFLAGS += --sysroot=/home/debian9/raspi/sysroot" "QMAKE_LFLAGS += --sysroot=/home/debian9/raspi/sysroot" -early "CONFIG += cross_compile" /home/debian9/raspi/qtbase/config.tests/arch
    + cd /home/debian9/raspi/qtbase/config.tests/arch && MAKEFLAGS= /usr/bin/make
    > /home/debian9/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -c -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/home/debian9/raspi/sysroot -O2 -std=gnu++11 -w -fPIC  -I. -I/home/debian9/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-vc4-g++ -o arch.o arch.cpp
    > arch.cpp:43:19: fatal error: stdio.h: No such file or directory
    >  #include <stdio.h>
    >                    ^
    > compilation terminated.
    > Makefile:180: recipe for target 'arch.o' failed
    > make: *** [arch.o] Error 1
    Project ERROR: Could not determine target architecture. See config.log for details.
    

    i noticed the few fatal errors in the log:

    > main.cpp:2:20: fatal error: alloca.h: No such file or directory
    
    > main.cpp:2:20: fatal error: malloc.h: No such file or directory
    
    > main.cpp:2:20: fatal error: stdlib.h: No such file or directory
    
    > arch.cpp:43:19: fatal error: stdio.h: No such file or directory
    

    any idea how to fix these errors? did i miss out something?


  • Qt Champions 2019

    @edwardy84 Does you sysroot contain all these header files?



  • @jsulm may i know how to verify this?



  • debian9@debian:~/raspi/sysroot/include$ ls 
    aio.h                expat_external.h    IMUDrivers      memory.h            pigpiod_if.h       setjmp.h             uchar.h
    aliases.h            expat.h             inttypes.h      misc                pigpio.h           sgtty.h              ucontext.h
    alloca.h             exynos              jbig85.h        mntent.h            pixman-1           shadow.h             ulimit.h
    alsa                 fcntl.h             jbig_ar.h       monetary.h          pngconf.h          signal.h             unicode
    argp.h               features.h          jbig.h          mqueue.h            png.h              sound                unistd.h
    argz.h               fenv.h              jerror.h        mtd                 pnglibconf.h       spawn.h              unixodbc_conf.h
    ar.h                 firebird            jmorecfg.h      mtdev.h             poll.h             sqldb.h              uodbc_extras.h
    arm-linux-gnueabihf  fmtmsg.h            jpegint.h       mtdev-mapping.h     postgresql         sqlext.h             uodbc_stats.h
    arpa                 fnmatch.h           jpeglib.h       mtdev-plumbing.h    printf.h           sqlfront.h           ustat.h
    asm-generic          fontconfig          KHR             mysql               protocols          sql.h                utime.h
    assert.h             freedreno           langinfo.h      net                 proxy.h            sqlite3ext.h         utmp.h
    atk-1.0              freetype2           lastlog.h       netash              pthread.h          sqlite3.h            utmpx.h
    at-spi-2.0           fstab.h             layout          netatalk            pty.h              sqlite.h             values.h
    at-spi2-atk          fts.h               lcms2.h         netax25             pulse              sqlspi.h             video
    audio                ftw.h               lcms2_plugin.h  netdb.h             pwd.h              sqltypes.h           wait.h
    autotest.h           gbm.h               libdrm          neteconet           python2.7          sqlucode.h           wayland-client-core.h
    bkpublic.h           _G_config.h         libexslt        netinet             python3.5          stab.h               wayland-client.h
    byteswap.h           gconv.h             libgen.h        netipx              python3.5m         stdc-predef.h        wayland-client-protocol.h
    c++                  gdb                 libinput.h      netiucv             rdma               stdint.h             wayland-cursor.h
    cairo                gdk-pixbuf-2.0      libintl.h       netpacket           readline           stdio_ext.h          wayland-egl-core.h
    cifsidmap.h          geany               libio.h         netrom              re_comp.h          stdio.h              wayland-egl.h
    clif.h               getopt.h            libltdl         netrose             regex.h            stdlib.h             wayland-server-core.h
    complex.h            gio-unix-2.0        libmng_conf.h   nfs                 regexp.h           string.h             wayland-server.h
    cpio.h               GL                  libmng.h        nl_types.h          reglib             strings.h            wayland-server-protocol.h
    crypt.h              GLES2               libmng_types.h  nss.h               resolv.h           stropts.h            wayland-util.h
    cspublic.h           GLES3               libmnl          numpy               rpc                sudo_plugin.h        wayland-version.h
    cstypes.h            glib-2.0            libpng          obstack.h           rpcsvc             sybdb.h              wchar.h
    ctpublic.h           glob.h              libpng16        odbcinstext.h       RTFusion.h         syberror.h           wctype.h
    ctype.h              gnumake.h           libsync.h       odbcinst.h          RTFusionKalman4.h  sybfront.h           wordexp.h
    cups                 gnu-versions.h      libudev.h       odbcss.h            RTFusionRTQF.h     sys                  X11
    dbus-1.0             graphite2           libxml2         omap                RTIMUAccelCal.h    syscall.h            xcb
    dirent.h             grp.h               libxslt         openssl             RTIMUCalDefs.h     sysexits.h           xen
    dlfcn.h              gshadow.h           limits.h        pango-1.0           RTIMUHal.h         syslog.h             xf86drm.h
    double-conversion    gstreamer-1.0       link.h          paths.h             RTIMULibDefs.h     tar.h                xf86drmMode.h
    EGL                  gtk-2.0             linux           pcmanfm-modules.h   RTIMULib.h         tds_sysdep_public.h  xkbcommon
    elf.h                gtk-3.0             locale.h        pcrecpparg.h        RTIMUMagCal.h      termio.h             xlocale.h
    endian.h             gtk-unix-print-2.0  ltdl.h          pcrecpp.h           RTIMUSettings.h    termios.h            zconf.h
    envz.h               harfbuzz            lxappearance    pcre.h              RTMath.h           tgmath.h             zlib.h
    epoxy                ibase.h             lzma            pcreposix.h         sched.h            thread_db.h
    err.h                iberror.h           lzma.h          pcre_scanner.h      scsi               time.h
    errno.h              ib_util.h           malloc.h        pcre_stringpiece.h  search.h           tslib.h
    error.h              iconv.h             math.h          perf.h              security           ttyent.h
    execinfo.h           ifaddrs.h           mcheck.h        pigpiod_if2.h       semaphore.h        uapi
    debian9@debian:~/raspi/sysroot/include$ 
    debian9@debian:~/raspi/sysroot/include$ ls -d allo* mallo* main* stdlib* stdio*
    ls: cannot access 'main*': No such file or directory
    alloca.h  malloc.h stdlib.h stdio.h
    

    i think these 4 header files are available at the sysroot/includes


  • Qt Champions 2019

    @edwardy84 Your sysroot does not look right. It should actually have same layout as the filesystem of your device, like:

    /raspi/sysroot/
                  |
                  - usr/
                       |
                       - include/
    ...
    

    How did you create your sysroot?



  • @jsulm i created the sysroot based on the step no 8 here https://wiki.qt.io/RaspberryPi2EGLFS

    mkdir sysroot sysroot/usr sysroot/opt
    rsync -avz pi@raspberrypi.local:/lib sysroot
    rsync -avz pi@raspberrypi.local:/usr/include sysroot/usr
    rsync -avz pi@raspberrypi.local:/usr/lib sysroot/usr
    rsync -avz pi@raspberrypi.local:/opt/vc sysroot/opt
    

    the sysroot/usr does exist, it contains lib folder.

    is it something wrong and how should i fix it?


  • Qt Champions 2019

    @edwardy84 said in RaspberryPi2EGLFS cross compile step 10 got error - Project ERROR: Could not determine target architecture:

    is it something wrong and how should i fix it?

    As I said this path is wrong: ~/raspi/sysroot/include
    It should be ~/raspi/sysroot/usr/include



  • @jsulm thanks for your catch. i have fixed this problem. and then i can run make and make install command then.

    .......
    Configure summary:
    
    Building on: linux-g++ (i386, CPU features: <none>)
    Building for: devices/linux-rasp-pi3-vc4-g++ (arm, CPU features: neon)
    Configuration: cross_compile compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 concurrent dbus no-pkg-config reduce_exports stl
    Build options:
      Mode ................................... release
      Optimize release build for size ........ no
      Building shared libraries .............. yes
      Using C++ standard ..................... C++11
      Using ccache ........................... no
      Using gold linker ...................... no
      Using new DTAGS ........................ yes
      Using precompiled headers .............. yes
      Using LTCG ............................. no
      Target compiler supports:
        NEON ................................. yes
      Build parts ............................ libs
    Qt modules and options:
      Qt Concurrent .......................... yes
      Qt D-Bus ............................... yes
      Qt D-Bus directly linked to libdbus .... no
      Qt Gui ................................. yes
      Qt Network ............................. yes
      Qt Sql ................................. yes
      Qt Testlib ............................. yes
      Qt Widgets ............................. yes
      Qt Xml ................................. yes
    Support enabled for:
      Using pkg-config ....................... no
      QML debugging .......................... yes
      udev ................................... yes
      Using system zlib ...................... yes
    Qt Core:
      DoubleConversion ....................... yes
        Using system DoubleConversion ........ yes
      GLib ................................... no
      iconv .................................. yes
      ICU .................................... no
      Logging backends:
        journald ............................. no
        syslog ............................... no
        slog2 ................................ no
      Using system PCRE2 ..................... no
    Qt Network:
      getaddrinfo() .......................... yes
      getifaddrs() ........................... yes
      IPv6 ifname ............................ yes
      libproxy ............................... no
      OpenSSL ................................ yes
        Qt directly linked to OpenSSL ........ no
      SCTP ................................... no
      Use system proxies ..................... yes
    Qt Gui:
      Accessibility .......................... yes
      FreeType ............................... yes
        Using system FreeType ................ no
      HarfBuzz ............................... yes
        Using system HarfBuzz ................ yes
      Fontconfig ............................. no
      Image formats:
        GIF .................................. yes
        ICO .................................. yes
        JPEG ................................. yes
          Using system libjpeg ............... yes
        PNG .................................. yes
          Using system libpng ................ yes
      EGL .................................... yes
      OpenVG ................................. no
      OpenGL:
        Desktop OpenGL ....................... no
        OpenGL ES 2.0 ........................ yes
        OpenGL ES 3.0 ........................ yes
        OpenGL ES 3.1 ........................ yes
      Session Management ..................... yes
    Features used by QPA backends:
      evdev .................................. yes
      libinput ............................... no
      INTEGRITY HID .......................... no
      mtdev .................................. no
      tslib .................................. yes
      xkbcommon-evdev ........................ no
    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. yes
      EGLFS details:
        EGLFS OpenWFD ........................ no
        EGLFS i.Mx6 .......................... no
        EGLFS i.Mx6 Wayland .................. no
        EGLFS RCAR ........................... no
        EGLFS EGLDevice ...................... no
        EGLFS GBM ............................ no
        EGLFS Mali ........................... no
        EGLFS Raspberry Pi ................... no
        EGL on X11 ........................... yes
      LinuxFB ................................ yes
      VNC .................................... yes
      Mir client ............................. no
      X11:
        Using system-provided XCB libraries .. yes
        EGL on X11 ........................... yes
        Xinput2 .............................. yes
        XCB XKB .............................. yes
        XLib ................................. yes
        XCB render ........................... yes
        XCB GLX .............................. yes
        XCB Xlib ............................. yes
        Using system-provided xkbcommon ...... no
    Qt Widgets:
      GTK+ ................................... no
      Styles ................................. Fusion Windows
    Qt PrintSupport:
      CUPS ................................... yes
    Qt Sql:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... yes
      PostgreSQL ............................. no
      SQLite2 ................................ yes
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... yes
    
    Note: Also available for Linux: linux-clang linux-icc
    
    Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing.
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/home/debian9/raspi/qt5pi'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

Log in to reply