Significance of sysroot while cross compiling QT5.5.1 for Beaglebone



  • Dear Developer,

    I want to understand significance of – sysroot option while configuring QT5.5.1 source for cross compiling for Beaglebone black platform.

    I have read following link to understand it but could not able to really understand its importance.
    http://doc.qt.io/qtcreator/creator-targets.html

    Additionally my main purpose to ask this question is, when I configure QT5.5.1 source for beaglebone black using -sysroot then I get many errors (given at the end of this message), whereas when I configure QT5.5.1 source for beaglebone black without using -sysroot then configuration and make steps get completed without any problem additionally I was able to run QT application on Beaglebone black.

    Configuration options given to configure Qt5.5.1 source is:

    ./configure -opensource -confirm-license -no-pch -prefix /opt/qt551-bbbhf -release -force-debug-info -device linux-bbbhf-g++ -make libs -nomake tests -nomake examples -device-option CROSS_COMPILE=/opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -v -qt-zlib -sysroot=/mnt/bbbhf```
    
    Please note: before giving above configuration command I mount beaglebone image on SD card to  my host machine by giving following command.
    
    

    mount /dev/sdx1 /mnt/bbbhf

    Thank you very much for your help

    Kind regards
    saurabh

    /Error after running configure command with -sysroot=/mnt/bbbhf/
    Determining architecture... ()

    /opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard --sysroot=/mnt/bbbhf -g -Wall -W -fPIC -I. -I../../mkspecs/devices/linux-bbbhf-g++ -o arch.o arch.cpp
    /opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -o arch arch.o -lrt -lpthread -ldl --sysroot=/mnt/bbbhf
    /mnt/bbbhf/usr/lib/arm-linux-gnueabihf/libdl.so: undefined reference to _dl_catch_error@GLIBC_PRIVATE' /mnt/bbbhf/usr/lib/arm-linux-gnueabihf/libdl.so: undefined reference to_dl_signal_error@GLIBC_PRIVATE'
    /mnt/bbbhf/usr/lib/arm-linux-gnueabihf/librt.so: undefined reference to `__close_nocancel@GLIBC_PRIVATE'
    collect2: error: ld returned 1 exit status
    Makefile:105: recipe for target 'arch' failed
    make: *** [arch] 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 -fPIC -I. -I../../mkspecs/linux-g++ -o arch.o arch.cpp
    g++ -o arch arch.o
    Found architecture in binary
    CFG_HOST_ARCH="x86_64"
    CFG_HOST_CPUFEATURES=" mmx sse sse2"
    System architecture: 'unknown'
    Host architecture: 'x86_64'
    C++11 auto-detection... ()
    /opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard --sysroot=/mnt/bbbhf -O2 -g -std=c++0x -Wall -W -fPIC -I. -I../../../mkspecs/devices/linux-bbbhf-g++ -o c++11.o c++11.cpp
    /opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -o c++11 c++11.o -lrt -lpthread -ldl --sysroot=/mnt/bbbhf
    /mnt/bbbhf/usr/lib/arm-linux-gnueabihf/libdl.so: undefined reference to _dl_catch_error@GLIBC_PRIVATE' /mnt/bbbhf/usr/lib/arm-linux-gnueabihf/libdl.so: undefined reference to_dl_signal_error@GLIBC_PRIVATE'
    /mnt/bbbhf/usr/lib/arm-linux-gnueabihf/librt.so: undefined reference to `__close_nocancel@GLIBC_PRIVATE'
    collect2: error: ld returned 1 exit status
    Makefile:106: recipe for target 'c++11' failed
    make: *** [c++11] Error 1
    C++11 disabled.
    sse2 auto-detection... ()
    /opt/arm-toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard --sysroot=/mnt/bbbhf -msse2 -g -Wall -W -fPIC -I. -I../../../mkspecs/devices/linux-bbbhf-g++ -o sse2.o sse2.cpp
    arm-linux-gnueabihf-g++: error: unrecognized command line option '-msse2'
    Makefile:197: recipe for target 'sse2.o' failed
    make: *** [sse2.o] Error 1


  • Lifetime Qt Champion

    Hi,

    The sysroot of a device is where Qt should be able to find all the dependencies needed for cross-compilation. For example, the specific OpenGL libraries for the device hardware. However, depending on the cross-compiler you are using and the sysroot age, you may have mismatch in the system libraries. For example a sysroot built with a way older gcc version than the cross-compiler.



  • Dear Sgaist,

    Thank you very much for your fast response.

    Please inform me whether I have it understood correctly:

    1. Sysroot: is path to folder on Host where it can find all libraries for device hardware.

    2. At this moment, I did not mention -sysroot while configuring Qt5.7.1 for beaglebone black hardware.

    Addtionally,I do not mention any syroot path while configuring QT creator kit and manually copy required libaries in beaglebone black while running Qt application on Beaglebone black hardware.

    Till now everything is working fine. So can you please tell me whether this approach is correct ? What are the disadvantages when I do not mention Sysroot path in Qt creator kit and manually copy libraries to Beaglebone black?

    Kind regards
    Saurabh Jain


  • Lifetime Qt Champion

    1. Yes but usually it's more than that. The sysroot is literally the filesystem that the device uses to run.
    2. If your cross-toolchain provides everything needed then you don't need the sysroot. However you might have disparities in the versions of the libraries available.


  • @SGaist said in Significance of sysroot while cross compiling QT5.5.1 for Beaglebone:

    Yes but usually it's more than that. The sysroot is literally the filesystem that the device uses to run.
    If your cross-toolchain provides everything needed then you don't need the sysroot. However you might have disparities in the versions of the libraries available.

    Thank you very @SGaist for answer :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.