Compile problem for Raspberry Pi again



  • Hey guys,

    first of all, thanks for all the work you spent on this project. I'm really looking forward to develop my first Qt applications for the pi.
    First of all, I am using ubuntu 14.10 64Bit.

    I tried to follow http://www.ics.com/blog/building-qt-5-raspberry-pi but I have problems compiling qtbase.

    I used several configurations found on the internet, but I get always the same error when compiling.

    my configuration options:
    ./configure
    -release
    -opengl es2
    -optimized-qmake
    -no-pch
    -make libs
    -make tools
    -sysroot /mnt/raspberry-rootfs
    -device linux-rasp-pi-g++
    -device-option CROSS_COMPILE=~/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-
    -prefix /usr/local/Qt-5.4.0-raspberry

    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/Qt-5.4.0-raspberry

    ./configure -release -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -prefix /usr/local/Qt-5.4.0-raspberry

    error:
    .obj/qlibrary_unix.o: In function QLibraryPrivate::load_sys()': qlibrary_unix.cpp:(.text+0x12e0): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libdl.a(dlopen.o): In functiondlopen':
    (.text+0xc): undefined reference to __dlopen' /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libdl.a(dlclose.o): In functiondlclose':
    (.text+0x0): undefined reference to __dlclose' /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libdl.a(dlsym.o): In functiondlsym':
    (.text+0xc): undefined reference to __dlsym' /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libdl.a(dlerror.o): In functiondlerror':
    (.text+0x0): undefined reference to __dlerror' /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libm.a(feholdexcpt.o): In functionfeholdexcept':
    (.text+0x48): undefined reference to _dl_hwcap' /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libm.a(fesetenv.o): In functionfesetenv':
    (.text+0x64): undefined reference to `_dl_hwcap'
    collect2: error: ld returned 1 exit status
    Makefile:1293: recipe for target '../../lib/libQt5Core.so.5.4.0' failed
    make[2]: *** [../../lib/libQt5Core.so.5.4.0] Error 1
    make[2]: Leaving directory '/home/david/raspberry/qt-everywhere-opensource-src-5.4.0/qtbase/src/corelib'
    Makefile:138: recipe for target 'sub-corelib-make_first' failed
    make[1]: *** [sub-corelib-make_first] Error 2
    make[1]: Leaving directory '/home/david/raspberry/qt-everywhere-opensource-src-5.4.0/qtbase/src'
    Makefile:45: recipe for target 'sub-src-make_first' failed
    make: *** [sub-src-make_first] Error 2

    In another thread somebody posted (maybe) the same problem. But the advice was to build without -reduce-exports, which I did.

    Thanks for your atention!



  • Use https://gitorious.org/cross-compile-tools/cross-compile-tools/blobs/master/fixQualifiedLibraryPaths
    to fix broken symlinks in your Image.

    The script should output all adjusted symlinks on success.



  • @sneubert
    I also have the same problem unfortunately
    I tried this but I don't get how this should work..

    My error is

    • tueco@ubuntu:~/opt/qt5/qtbase$ sudo ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5pi
      This is the Qt Open Source Edition.
      You are licensed to use this software under the terms of
      the Lesser GNU General Public License (LGPL) versions 2.1.
      You are also licensed to use this software under the terms of
      the GNU Lesser General Public License (LGPL) versions 3.
      You have already accepted the terms of the Open Source license.
      /home/tueco/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
      /home/tueco/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
      <srcbase> = /home/tueco/opt/qt5/qtbase
      <outbase> = /home/tueco/opt/qt5/qtbase
      Creating qmake...
      .Done.
      Running configuration tests...
      Note: PKG_CONFIG_LIBDIR automatically set to /mnt/rasp-pi-rootfs/usr/lib/pkgconfig:/mnt/rasp-pi-rootfs/usr/share/pkgconfig
      Note: PKG_CONFIG_SYSROOT_DIR automatically set to /mnt/rasp-pi-rootfs
      Could not determine the target architecture!
      Turn on verbose messaging (-v) to see the final report.
      The OpenGL ES 2.0 functionality test failed!
      You might need to modify the include and library search paths by editing
      QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in
      /home/tueco/opt/qt5/qtbase/mkspecs/devices/linux-rasp-pi-g++.

    I don't really get what I am supposed to do..



  • @jorricks
    This does not seem to be the same issue.
    Your output states, that the cross-compiler can not be started, because of missing libstdc++. This is not a linker problem.
    Is the libstdc++6 package installed on your development host?



  • @sneubert
    ah nvm.. I found that it had to do with the configure not being able to find the right device



  • This post is deleted!


  • @AQTStudent Hi there,

    I seems to be experiencing the same issue, Could you kndly share what the solution was for this?

    Thanks in advance!



  • hi all,

    i have the same issues, and i fixed it.
    but i dont really know, what i do is fixed the issue.

    the problem is we cant Using 'dlopen, dlclose, etc' in statically,

    if we go to diirectory /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/

    and run

    sudo file * | grep broken

    there is many dynamic library broken symlink, so the toolcain automatic using static library. thats why, it show warning dlopen..

    note : if we finished cros compile and install, u need to get back symlink.

    #!/bin/bash
    #This script is ugly, feel free to fix it

    if [ "$#" -ne 2 ]; then
    echo "usage ./cmd target-rootfs path-to-target-toolchain-compiler"
    exit -1
    fi

    #passed args
    ROOTFS=$1
    TOOLCHAIN=$2

    if [ -x $TOOLCHAIN ]; then
    echo "Passed valid tool"
    MACHINE=$($TOOLCHAIN -dumpmachine)
    DEB_MULTI_ARCH_MADNESS=$ROOTFS/usr/lib/$MACHINE

    fi

    INITIAL_DIR=$PWD

    function adjustSymLinks1
    {
    echo "Adjusting the symlinks in $1 to be relative"

    cd $1
    

    echo $PWD
    find . -maxdepth 1 -type l | while read i;
    do qualifies=$(file $i | grep broken)
    if [ -n "$qualifies" ]; then
    newPath=$(file $i | grep broken | grep /etc| sed 's/^.*to //');
    echo $i
    echo /mnt/rasp-pi-rootfs$newPath;
    sudo rm $i;
    sudo ln -s /mnt/rasp-pi-rootfs$newPath $i;
    fi
    done
    cd $INITIAL_DIR
    }

    echo "Testing for existence of potential debian multi-arch dir: $DEB_MULTI_ARCH_MADNESS"

    function adjustSymLinks2
    {
    echo "Adjusting the symlinks in $1 to be relative"

    cd $1
    

    echo $PWD
    find . -maxdepth 1 -type l | while read i;
    do qualifies=$(file $i | grep broken | grep /lib/arm)
    if [ -n "$qualifies" ]; then
    newPath=$(file $i | grep broken | grep /lib/arm | sed 's/^.*to //');
    echo $i
    echo /mnt/rasp-pi-rootfs$newPath;
    sudo rm $i;
    sudo ln -s /mnt/rasp-pi-rootfs$newPath $i;
    fi
    done
    cd $INITIAL_DIR
    }

    if [ -n "$DEB_MULTI_ARCH_MADNESS" -a -e "$DEB_MULTI_ARCH_MADNESS" ]; then
    echo "Debian multiarch dir exists, adjusting"
    adjustSymLinks2 $DEB_MULTI_ARCH_MADNESS "../../.."
    fi



  • @Lutfi88 Thank you for the solution, this solved my problem with "undefined reference to __dlsym"



  • There is a very handy package which eases the symlink problem a lot:

    sudo apt-get symlinks
    

    then

    sudo symlinks -cr /lib
    sudo symlinks -cr /usr/lib
    sudo symlinks -cr /usr/local/lib
    

    will fix your problems.


Log in to reply