Cross-compilation on PC/UBUNTU for target PANDABOARD/UBUNTU.



  • Hello,

    I discover this forum during the building of my first Qt application. It is the first time I use it.
    I cross compile a Qt project on a PC/UBUNTU for the target : PANDABOARD/UBUNTU.
    I obtain a binary and run it on the PANDABOARD.
    I obtain the following message :
    "Could not find the Qt platform xcb"
    After reading some articles in qt-project.org, I understand I need to generate the dynamic library libxcb.so.1 on my PC/UBUNTU for the PANDABOARD/UBUNTU.
    Please, could you help me to cross compile this library on my PC/UBUNTU ?

    Best regards.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Since your PandaBoard runs ubuntu, why not use the package manager from it to install the missing libraries ?



  • Hi

    Thanks for your answer.

    I specify the complete message after running :

    This application failed to start because it could not find or load the Qt platform plugin "xcb".Reinstalling the application may fix this problem. Aborted (core dumped)

    I think the xcb package is already present on my target PANDABOARD/UBUNTU.
    Indeed, the result of the command

    sudo apt-cache pkgnames | grep xcb is :
    libxcb-doc

    libxcb-image0

    libxcb-sync0

    libxcb-render-util0

    libxcb-dpms0

    libxcb-glx0-dbg

    libxcb-glx0-dev

    libxcb-xprint0

    libxcb-icccm4-dev

    libxcb-xinerama0-dbg

    libxcb-keysyms1

    libxcb-xinerama0-dev

    libxcb-xevie0-dbg

    libxcb-shm0-dbg

    libxcb-icccm4

    libxcb-composite0-dbg

    libxcb-xevie0-dev

    libxcb-shm0-dev

    libxcb-composite0-dev

    libxcb-dri2-0-dbg

    libxcb-dri2-0-dev

    libxcb-xv0

    libxcb-screensaver0-dbg

    libxcb-glx0

    libxcb-screensaver0-dev

    libxcb-xevie0

    libxcb-xfixes0

    libxcb-sync0-dbg

    python-xcbgen

    libxcb-sync0-dev

    libx11-xcb1

    libxcb-util0

    libxcb-keysyms1-dev

    libxcb-xvmc0

    libxcb-render0

    libxcb-damage0-dbg

    libxcb-damage0-dev

    libxcb-res0-dbg

    libxcb-res0-dev

    libxcb1

    libxcb-shape0-dbg

    libxcb-shape0-dev

    libx11-xcb-dev

    libxcb-render-util0-dev

    libxcb-damage0

    libxcb-shape0

    xcb-proto

    libxcb-randr0-dbg

    libxcb-randr0-dev

    libxcb-xinerama0

    libx11-xcb1-dbg

    libxcb-randr0

    libxcb-composite0

    libxcb-xv0-dbg

    libxcb-xv0-dev

    xcb

    libxcb-dpms0-dbg

    libxcb-dpms0-dev

    libxcb-ewmh1

    libxcb-dri2-0

    libxcb-xf86dri0-dbg

    libxcb-xf86dri0-dev

    libxcb-xf86dri0

    libxcb-res0

    libxcb-util0-dev

    libxcb-xfixes0-dbg

    libxcb-render0-dbg

    libxcb-xfixes0-dev

    libxcb-record0-dbg

    libxcb-render0-dev

    libxcb-record0

    libxcb-xvmc0-dbg

    libxcb-record0-dev

    libxcb1-dbg

    libxcb-xvmc0-dev

    libxcb1-dev

    libxcb-shm0

    libxcb-xtest0

    libxcb-xtest0-dbg

    libxcb-xtest0-dev

    libxcb-image0-dev

    libxcb-ewmh1-dev

    libxcb-screensaver0

    libxcb-xprint0-dbg

    libxcb-xprint0-dev

    Best regards.


  • Lifetime Qt Champion

    Did you also installed the Qt dlls along with your application ?



  • No because my target is PANDABOARD / UBUNTU.
    After reading the deployment documentation it seems I need to compile the pluggin "xcb" :

    but I am not able to produce the xcb dynamic library.

    In the following directory :
    qt-everywhere-opensource-src-5.2.1/qtbase/src/plugins/platforms/xcb

    cd ../xcbplugins
    make clean
    qmake -config release
    make

    Do you agree with this approach ?

    Thanks and best regards.


  • Lifetime Qt Champion

    Before compiling anything, did you also deploy the Qt 5 plugins ?



  • Yes I deployed Qt 5 plugins (qtbase/plugins/platforms) on my target in the directory ./platforms.
    But I think the xcb pluggin is lacked.
    By running my application with gdb on my target I obtained the following message:

    This application failed to start because it could not find or load the Qt platform plugin “xcb”.
    Available platform pluggins are: linuxfb(from ./platforms), minimal (from ./platforms), offsreen (from ./platforms).

    The error message is produced by QGuiApplicationPrivate::createPlatformIntegration() function

    So, I think there is a problem because the xcb platform is not present in
    qtbase/plugins/platforms.

    Do you agree ?

    Thanks.


  • Lifetime Qt Champion

    If it wasn't already built, it means that the test for it failed.

    Do a new configure and force the use of xcb, you'll probably see it failed stating that the needed libraries/headers where not found. If it's the case, you are missing the necessary dev packages for it



  • Hi,

    Indeed there are problems during the new configure with -xcb.
    I read src/plugins/platforms/xcb/README and install all the dependency packages for libxcb.
    I found all the libraries thanks to the following command :
    sudo apt-cache pkgnames | grep "libxcb*"

    So, I do not understand why the last 3 lines of the message :
    "The test for linking against libxcb failed!
    You might need to install dependency packages for libxcb.
    See src/plugins/platforms/xcb/README"

    The result of the configure command is the following :
    Sorry for the size of the message but I am not able to specify which piece of information is important.

    ./configure -xcb -v -prefix /home/stimg/QT/qt-everywhere-opensource-src-5.2.1/qtbase -skip connectivity -qreal float -nomake tests -nomake examples -opensource -xplatform linux-arm-gnueabi-g++

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    BEGIN MESSAGE
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    DEFAULT_LIBDIRS="/usr/lib/gcc/arm-linux-gnueabihf/4.6
    /usr/lib/gcc/arm-linux-gnueabihf/lib
    Creating qmake...
    make: Nothing to be done for `first'.
    Running configuration tests...
    Warning: Disabling pkg-config since PKG_CONFIG_LIBDIR is not set.
    Warning: Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set.
    Determining architecture... ()
    arm-linux-gnueabihf-g++-4.6 -c -pipe -g -Wall -W -fPIE -I../../mkspecs/linux-arm-gnueabi-g++ -I. -o arch.o arch.cpp
    arm-linux-gnueabihf-g++-4.6 -o arch arch.o
    /usr/bin/arm-linux-gnueabihf-ld: unrecognised emulation mode: armelf_linux_eabi
    Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om
    collect2: ld returned 1 exit status
    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 -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]).([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="x86_64"
    CFG_HOST_CPUFEATURES=" mmx sse sse2"
    System architecture: 'unknown'
    Host architecture: 'x86_64'
    C++11 auto-detection... ()
    arm-linux-gnueabihf-g++-4.6 -c -pipe -O2 -std=c++0x -Wall -W -fPIE -I../../../mkspecs/linux-arm-gnueabi-g++ -I. -o c++11.o c++11.cpp
    arm-linux-gnueabihf-g++-4.6 -Wl,-O1 -o c++11 c++11.o
    /usr/bin/arm-linux-gnueabihf-ld: unrecognised emulation mode: armelf_linux_eabi
    Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om
    collect2: ld returned 1 exit status
    make: *** [c++11] Error 1
    C++11 disabled.
    floatmath auto-detection... ()
    arm-linux-gnueabihf-g++-4.6 -c -pipe -O2 -Wall -W -fPIE -I../../../mkspecs/linux-arm-gnueabi-g++ -I. -o floatmath.o floatmath.cpp
    floatmath.cpp:44:5: warning: unused parameter ‘argc’ [-Wunused-parameter]
    floatmath.cpp:44:5: warning: unused parameter ‘argv’ [-Wunused-parameter]
    arm-linux-gnueabihf-g++-4.6 -Wl,-O1 -o floatmath floatmath.o
    /usr/bin/arm-linux-gnueabihf-ld: unrecognised emulation mode: armelf_linux_eabi

    ...

    evdev disabled.
    XLib auto-detection... ()
    arm-linux-gnueabihf-g++-4.6 -c -pipe -O2 -Wall -W -fPIE -I../../../mkspecs/linux-arm-gnueabi-g++ -I. -o xlib.o xlib.cpp
    arm-linux-gnueabihf-g++-4.6 -Wl,-O1 -o xlib xlib.o -lXext -lX11 -lm
    /usr/bin/arm-linux-gnueabihf-ld: unrecognised emulation mode: armelf_linux_eabi
    Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om
    collect2: ld returned 1 exit status
    make: *** [xlib] Error 1
    XLib disabled.
    xcb auto-detection... ()
    arm-linux-gnueabihf-g++-4.6 -c -pipe -O2 -Wall -W -fPIE -I../../../mkspecs/linux-arm-gnueabi-g++ -I. -o xcb.o xcb.cpp
    xcb.cpp: In function ‘int main(int, char**)’:
    xcb.cpp:47:23: warning: unused variable ‘t’ [-Wunused-variable]
    arm-linux-gnueabihf-g++-4.6 -Wl,-O1 -o xcb xcb.o -lxcb
    /usr/bin/arm-linux-gnueabihf-ld: unrecognised emulation mode: armelf_linux_eabi
    Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om
    collect2: ld returned 1 exit status
    make: *** [xcb] Error 1
    xcb disabled.
    The test for linking against libxcb failed!
    You might need to install dependency packages for libxcb.
    See src/plugins/platforms/xcb/README.
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    END MESSAGE
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


  • Lifetime Qt Champion

    You need the arm version of these libraries



  • Hi

    I put all the xcb libraries loaded on my PANDABOARD/UBUNTU described in the README in the directory :
    /usr/lib/gcc/arm-linux-gnueabihf/4.6 on my PC/UBUNTU.
    But the result is always the same after the configuration :

    xcb disabled.
    The test for linking against libxcb failed! You might need to install dependency packages for libxcb. See src/plugins/platforms/xcb/README.

    Best regards.


  • Lifetime Qt Champion

    You should rather point the configure script to the folder where the libraries can be found they have dependencies that might not be seen



  • Hi

    I modified the file /usr/lib/gcc/arm-linux-gnueabihf/4.6/pkgconfig/xcb.pc
    thus I can specify the access to the static library libxcb.a (coming from my target). Nevertheless I obtain the same message :
    arm-linux-gnueabihf-g++-4.6 -Wl,-O1 -o xcb xcb.o -L//usr/lib/gcc/arm-linux-gnueabihf/4.6 -lxcb

    /usr/bin/arm-linux-gnueabihf-ld: unrecognised emulation mode: armelf_linux_eabi
    Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om
    collect2: ld returned 1 exit status
    make: *** [xcb] Error 1
    xcb disabled.
    How must I resolve the problem /usr/bin/arm-linux-gnueabihf-ld: unrecognised emulation mode: armelf_linux_eabi ?

    Best regards.


  • Lifetime Qt Champion

    Looking for that error, it seems you might be encountering a bug of gcc



  • Hi

    It seems there is not any solution to my problem.

    Best regards.


  • Lifetime Qt Champion

    The only I see is to update gcc, is there not a more recent version available ?



  • I do not find a more recent version but I find a workaround.
    I am not sure to well understant it.
    The workaround suggests to modify the configure.tgt file for the linker :

    This is the linker target specific file. This is invoked by the autoconf generated configure script. Putting it in a separate shell file lets us skip running autoconf when modifying target specific.

    The content of the config.tgt is the following :
    --- ld/configure.tgt.orig 2011-04-05 20:22:23.000000000 +0000

                        targ_extra_emuls="armelfb armelf armelf_linux" 
                        targ_extra_libpath="armelf_linux" 
                        ;; 
    

    -arm*--linux-eabi) targ_emul=armelf_linux_eabi
    +arm
    -
    -linux-eabi) targ_emul=armelf_linux_eabi
    targ_extra_emuls=armelfb_linux_eabi
    targ_extra_libpath=$targ_extra_emuls

                        targ_extra_emuls="armelf armelfb armelfb_linux" 
                        targ_extra_libpath="armelfb_linux" 
                        ;; 
    

    -arm*--uclinuxeabi) targ_emul=armelf_linux_eabi
    +arm*--uclinuxeabi*) targ_emul=armelf_linux_eabi
    targ_extra_emuls=armelfb_linux_eabi
    targ_extra_libpath=$targ_extra_emuls
    ;;

    For me I need to compile the loader arm-linux-gnueabi-g++-4.6 by using the previous file.

    Do you agree ?

    Thanks and best regards.


  • Lifetime Qt Champion

    Worth to try


Log in to reply
 

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