Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] QT5 on Tegra2, crosscompiling problem
QtWS25 Last Chance

[SOLVED] QT5 on Tegra2, crosscompiling problem

Scheduled Pinned Locked Moved Mobile and Embedded
15 Posts 3 Posters 14.5k Views
  • 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.
  • B Offline
    B Offline
    bricke
    wrote on 15 Mar 2013, 15:46 last edited by
    #1

    Hi all, I'm Matteo from Italy, I'm finding some problem crosscompiling Qt5 for my Colibri T20 device (Nvidia Tegra 2).

    I've the toolchain from the vendor (Toradex) and also the rootfs.
    I've downloaded the stable version of Qt5 from git and now I'm compiling with the following command:

    @./configure -opengl es2 -device tegra2 -device-option CROSS_COMPILE=~/QT5/compiler/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin/arm-linux-gnueabihf- -sysroot ~/QT5/rootfs/ -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5pi -v@

    But my code stops with the folowing error:
    @Note: PKG_CONFIG_SYSROOT_DIR automatically set to /home/matteo/QT5/rootfs/
    Determining architecture... ()
    /home/matteo/QT5/compiler/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin/arm-linux-gnueabihf-g++ -c -pipe -mtune=cortex-a9 -march=armv7-a -mhard-float -mfloat-abi=softfp -mfpu=vfpv3-d16 -mfloat-abi=softfp --sysroot=/home/matteo/QT5/rootfs/ -g -Wall -W -fPIE -I../../mkspecs/devices/linux-tegra2-g++ -I. -I/home/matteo/QT5/rootfs/usr/include -o arch.o arch.cpp
    arch.cpp:45:19: fatal error: stdio.h: No such file or directory
    compilation terminated.
    make: *** [arch.o] Error 1
    Unable to determine architecture!

    Could not determine the target architecture!
    Turn on verbose messaging (-v) to see the final report.
    Determining architecture... ()
    g++ -c -pipe -g -Wall -W -fPIE -I../../mkspecs/linux-g++ -I. -o arch.o arch.cpp
    g++ -o arch arch.o
    { test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9]+([0-9]).([0-9]).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 'arch' && test -f arch.gdb-index && objcopy --add-section '.gdb_index=arch.gdb-index' --set-section-flags '.gdb_index=readonly' 'arch' 'arch' && rm -f arch.gdb-index || true
    Found architecture in binary
    CFG_HOST_ARCH="i386"
    CFG_HOST_CPUFEATURES=""
    System architecture: 'unknown'
    Host architecture: 'i386'
    C++11 auto-detection... ()
    ...
    @

    It seems that my system don't found stdio.h, but I've all the relative packet for compiling installed and if I launch a locate stdio.h in the result I've also:
    @/usr/include/stdio.h
    /usr/include/bits/stdio.h
    /usr/include/c++/4.6/tr1/stdio.h
    /usr/include/i386-linux-gnu/bits/stdio.h
    /usr/lib/perl/5.14.2/CORE/nostdio.h
    /usr/lib/syslinux/com32/include/stdio.h@

    Do you have some hints? I've searched a lot but it seems that everyone could compile for tegra2 but me :(.
    I've also an openembedded env on my machine, so if you have some recipes for qt5 I can use it.

    Thanks.

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zhxt
      wrote on 16 Mar 2013, 04:00 last edited by
      #2

      'stdio.h's in /usr/include are for host, not for target board. the one which you need should be in toolchain directory.

      So I think you can check your toolchain first, try another one for test.

      Qt Developer

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bricke
        wrote on 18 Mar 2013, 07:41 last edited by
        #3

        So, how can I tell the crosscompiler to use the one in my toolchain dir?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bricke
          wrote on 18 Mar 2013, 08:40 last edited by
          #4

          I've managed this error, I've linked in the configure options the right sysroot from my OE environment but now the config command give me other errors:

          error: arch uses VFP register arguments, arch.o does not

          Is the linux-tegra2-g++/qmake.conf in mkspeks/device folder up to date?

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zhxt
            wrote on 18 Mar 2013, 14:35 last edited by
            #5

            I'm also not sure if there is a new version qmake.conf for T2.

            I guess some of this TEGRA2_CFLAGS flags caused this problem.
            but I do not know which one is.

            -mhard-float -mfloat-abi=softfp -mfpu=vfpv3-d16

            Qt Developer

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bricke
              wrote on 18 Mar 2013, 15:16 last edited by
              #6

              I've made a step, my configure settings are:
              @
              ./configure -make libs
              -xplatform linux-tegra2-g++
              -platform linux-g++-32
              -prefix /home/matteo/oe-core/build/out-eglibc/sysroots/colibri-t20/opt
              -sysroot /home/matteo/oe-core/sysroot
              -confirm-license
              -opensource -v
              @

              I've created a linux-tegra2-gxx folder under mkspecs and I've populated it as follow:
              @
              include(../devices/common/linux_device_pre.conf)

              modifications to g++.conf

              QMAKE_CC = arm-angstrom-linux-gnueabi-gcc
              QMAKE_CXX = arm-angstrom-linux-gnueabi-g++
              QMAKE_LINK = arm-angstrom-linux-gnueabi-g++
              QMAKE_LINK_SHLIB = arm-angstrom-linux-gnueabi-g++

              modifications to linux.conf

              QMAKE_AR = arm-angstrom-linux-gnueabi-ar cqs
              QMAKE_OBJCOPY = arm-angstrom-linux-gnueabi-objcopy
              QMAKE_STRIP = arm-angstrom-linux-gnueabi-strip

              QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include

              QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib
              $$[QT_SYSROOT]/lib
              $$[QT_SYSROOT]/usr/lib/arm-angstrom-linux-gnueabi

              QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib
              -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-angstrom-linux-gnueabi
              -Wl,-rpath-link,$$[QT_SYSROOT]/lib

              TEGRA2_CFLAGS = -mtune=cortex-a9 -march=armv7-a -mhard-float -mfloat-abi=softfp -mfpu=vfpv3-d16
              QMAKE_CFLAGS += $$TEGRA2_CFLAGS
              QMAKE_CXXFLAGS += $$TEGRA2_CFLAGS

              include(../devices/common/linux_device_post.conf)

              load(qt_config)
              @

              arm-angstrom-linux-gnueabi- is on my path

              But when I launch the command it exits with the Error: "Unable to determine the architecture", but the strange things is that the first line in the console after executing the command is:
              @cc1plus: warning: include location "/usr/include/i386-linux-gnu" is unsafe for cross-compilation [-Wpoison-system-directories]@

              Any ideas? It's seems that my system uses the host machine files instead of the tegra2 for configuring. I think that the final error is due to this wrong configuration, but I don't know how to eliminate it.

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                zhxt
                wrote on 19 Mar 2013, 15:13 last edited by
                #7

                The makespec for Tegra2 is in the same dir as for RaspPi. So I think a easy way is starting from build instructions for pi.
                just simply change the device option to linux-tegra2-g++ (gussed), set the proper toolchain path, sysroot path and prefix.

                @
                $ ./configure -prefix <your prefix> -release
                -device linux-tegra2-g++ -make libs
                -device-option CROSS_COMPILE=<your toolchain path>/bin/arm-none-linux-gnueabi-
                -sysroot <your sysroot path> -v
                @

                of course you also can append some options like -opensoure -confirm-license which is unconcerned with these ERRORs.

                And see what will happed.

                Qt Developer

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  bricke
                  wrote on 19 Mar 2013, 15:19 last edited by
                  #8

                  If you read my previous post you can note that I've already done some test in that way.

                  The -device option for tegra is tegra2, as already written, not linux-tegra2-g++, and one week ago I've started this "adventure" from the Rasp guide, but unfortunately it's not that easy.

                  I'm thinking that my toolchain is broken or my env, when building the errors comes with the host libraries that my env caches in "/usr/include/i386-linux-gnu" and I don't know why.

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    zhxt
                    wrote on 20 Mar 2013, 06:51 last edited by
                    #9

                    1, My guess about linux-tegra2-g++ have no effect with this errors, cause it's the same as tegra2. (the pattern is: "* tegra2*" ).

                    2, As my first reply, I doubt the toolchain, because mine has these missing headers, So it can found automatically. If it does not have, use -sysroot to override the default searching path should work, if -sysroot is not set, it will goes to host path.

                    Because when the variable QT_SYSROOT is blank.
                    @QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include@

                    equal to

                    @QMAKE_INCDIR += /usr/include@

                    I'm not exactly sure, but it make sense.

                    3, Continue digging my second reply. TRY TO:

                    add "DISTRO_OPTS += hard-float" and change the value of "-mfloat-abi" to "hard" to the default qmake.conf in mkspec/device/linux-tegra2-g++

                    @
                    DISTRO_OPTS += hard-float
                    TEGRA2_CFLAGS = -mtune=cortex-a9 -march=armv7-a -mhard-float -mfloat-abi=hard -mfpu=vfpv3-d1
                    @

                    Then use the first configuration(rpi-like) to build.

                    BTW, attention to the sentence bellow in that qmake.conf:
                    CAUTION: The Tegra2 chips don't support neon, make sure it will not be used (-no-neon)

                    Qt Developer

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      bricke
                      wrote on 20 Mar 2013, 08:08 last edited by
                      #10

                      Thanks for the tip, I will try it later.

                      By now I've successfully terminated the configure script with some hack (I've bypassed the /usr/include/i386-linux-gnu folder by linking the arm folder in the same place)

                      @
                      Debug .................. no
                      C++11 support .......... yes
                      pkg-config ............. yes
                      Qt D-Bus module ........ yes (run-time)
                      Qt Concurrent code ..... yes
                      Qt GUI module .......... yes
                      Qt Widgets module ...... yes
                      JavaScriptCore JIT ..... To be decided by JavaScriptCore
                      QML debugging .......... yes
                      PCH support ............ no
                      iWMMXt support ......... no
                      NEON support ........... no
                      IPv6 ifname support .... yes
                      getaddrinfo support .... yes
                      getifaddrs support ..... yes
                      Accessibility .......... yes
                      NIS support ............ yes
                      CUPS support ........... no
                      Iconv support .......... yes
                      Glib support ........... yes
                      GStreamer support ...... yes
                      PulseAudio support ..... yes
                      Large File support ..... yes
                      GIF support ............ plugin
                      JPEG support ........... plugin (system)
                      PNG support ............ yes (system)
                      zlib support ........... system
                      Session management ..... auto
                      libudev support ........ yes
                      Use system proxies ..... no
                      OpenGL support ......... yes (OpenGL ES 2.x)
                      OpenVG support ......... no
                      XShape support ......... auto
                      XVideo support ......... auto
                      XSync support .......... auto
                      Xinerama support ....... runtime
                      Xcursor support ........ runtime
                      Xfixes support ......... runtime
                      Xrandr support ......... runtime
                      Xi support ............. no
                      Xi2 support ............ yes
                      MIT-SHM support ........ auto
                      FontConfig support ..... yes
                      XKB Support ............ auto
                      GTK theme support ...... yes
                      MySQL support .......... plugin
                      PostgreSQL support ..... plugin
                      SQLite 2 support ....... plugin
                      SQLite support ......... plugin (qt)
                      OpenSSL support ........ yes (run-time)
                      Alsa support ........... yes
                      libICU support ......... no
                      PCRE support ........... qt
                      Xcb support ............ qt
                      Xrender support ........ yes
                      EGLFS support .......... yes
                      DirectFB support ....... no
                      LinuxFB support ........ yes
                      KMS support ............ no
                      @

                      but I've used the -platform and -xplatform options instead of the -device one.

                      However, I cannod understand if I will be able to run GUI application with hardware acceleration, I need to run gui app on FB, but I can only see LinuxFB support...

                      1 Reply Last reply
                      0
                      • Z Offline
                        Z Offline
                        zhxt
                        wrote on 20 Mar 2013, 08:29 last edited by
                        #11

                        LinuxFB is not FB?

                        Qt Developer

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          bricke
                          wrote on 20 Mar 2013, 08:32 last edited by
                          #12

                          I don't know, I read:
                          DirectFB support no
                          LinuxFB support yes

                          So I'm having some doubt...

                          1 Reply Last reply
                          0
                          • Z Offline
                            Z Offline
                            zhxt
                            wrote on 20 Mar 2013, 08:45 last edited by
                            #13

                            I think yes, Linux FB is FB, but DirectFB is on top of FB. http://qt-project.org/doc/qt-4.8/qt-embeddedlinux-accel.html

                            If you want to use hardware acceleration, May be you also need DirectFB or OpenGL ES | Open VG. learnd from the above link.

                            Qt Developer

                            1 Reply Last reply
                            0
                            • B Offline
                              B Offline
                              bricke
                              wrote on 20 Mar 2013, 14:32 last edited by
                              #14

                              I have the CPLUS_INCLUDE_PATH and C_INCLUDE_PATH variable setted to /usr/include/i386-linux-gnu that gives me a lot of trouble!

                              Unsetting the CPLUS one let me terminate my configure correctly, and then my make command blocked on the same dir, so I've insetted the C_INCLUDE_PATH and now it's compiling...

                              Now I'm able to terminate the configure script with:
                              @./configure -make libs
                              -prefix /opt/qt5_teo
                              -sysroot /home/matteo/oe-core/sysroot
                              -device tegra2
                              -device-option CROSS_COMPILE=/home/matteo/matteo_test/gcc-linaro/bin/arm-linux-gnueabihf-
                              -no-neon
                              -opengl es2
                              -qt-xcb
                              -confirm-license
                              -nomake examples -nomake tests
                              -optimized-qmake
                              -reduce-relocations
                              -release
                              -opensource -v
                              @

                              and the tegra2 device qmake as follow:
                              @
                              include(../common/linux_device_pre.conf)

                              QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include

                              QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib
                              $$[QT_SYSROOT]/lib
                              $$[QT_SYSROOT]/usr/lib/arm-angstrom-linux-gnueabi/4.7.2

                              QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib
                              -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-angstrom-linux-gnueabi/4.7.2
                              -Wl,-rpath-link,$$[QT_SYSROOT]/lib

                              DISTRO_OPTS += hard-float
                              TEGRA2_CFLAGS = -mtune=cortex-a9 -march=armv7-a -mhard-float -mfloat-abi=hard -mfpu=vfpv3-d16
                              QMAKE_CFLAGS += $$TEGRA2_CFLAGS
                              QMAKE_CXXFLAGS += $$TEGRA2_CFLAGS

                              include(../common/linux_device_post.conf)

                              load(qt_config)
                              @

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                RhnBlk
                                wrote on 26 Jun 2013, 08:19 last edited by
                                #15

                                I'm using qt 4.8.4 for toradex colibri_t20. Configuring it was not a problem, but I'm facing issues in executing programs. U can find the post here "://http://qt-project.org/forums/viewthread/29274/"

                                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