cross compile for arm with boost lib



  • Hello all,
    i'm new on this forum. I'm using QT since 3 months. It works fine, but I'm stuck with an error.
    I have this error when I try to compile my project:

    "cannot finf -lboost_system"
    

    I use QTcreator on ubuntu 14 I setup 2 kits to compile my project: desktop and another one for arm with arm-linux-gnueabihf-g++
    I need to use boost library, so in .pro file I added :

    LIBS += -lboost_system
    

    I had install all boost library.
    With the desktop kit it compile well and the apps works fine.
    But If I try to cross compile with arm-linux-gnueabihf-g++ I get this error:
    "cannot finf -lboost_system"

    Any idea what I miss or doing wrong ?

    Thanks


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If you want to use boost on your target then you must make it available for your target also. How did you provide the dependencies for Qt in the first place ? If it is using your device root filesystem then install the boost library dev packages through your device package manager.



  • Thanks sgaist for your answer.

    I use yocto/poky to compile the image and rootfs. I have include all the lib I need for my project and my target.
    I use a custom scritp to launch QT. In this script I had include:

    SOURCE /opt/.../environement-setup-cortexa5hf-vfp-poky-linux-gnueabi
    

    I have the boost library in the directory :
    opt/poky/1.5.sysroots/x86_64-pokysdk-linux/usr/include

    This way is a little bit nasty but it should works ?


  • Lifetime Qt Champion

    The boost handling should rather be part of your .pro file i.e:

    INCLUDEPATH += /opt/poky/1.5.sysroots/x86_64-pokysdk-linux/usr/include
    LIBS += -L/opt/poky/1.5.sysroots/x86_64-pokysdk-linux/usr/lib
    

    Replace the lib path accordingly



  • I'm back into this project.
    I modified the pro file:

    INCLUDEPATH += /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/include
    LIBS += -L/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/lib
    LIBS += -lboost_system
    

    all the .hpp files are in the folder:
    /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/include
    all the libboost***.so are in the folder:
    /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/lib

    Now when I include a boost header:

    #include <boost/asio/signal_set.hpp>
    

    I get these errors:

    /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/lib/libboost_system.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned int&, unsigned int)@GLIBCXX_3.4.21'
    /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/lib/libboost_system.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21'
    collect2: error: ld returned 1 exit status
    

    It looks like it doesn't find some others libraries ?


  • Lifetime Qt Champion

    Looks like you're not building your application with C++11 enabled.

    Add CONFIG += c++11 to your .pro file.



  • I already add to my .pro file:

    CONFIG += C++11
    QMAKE_CXXFLAGS += -std=C++11

    As I compile with a sdk (gcc for arm) done from yocto for a Sama5d3, I guess I need to add something to the SDK or strait to the folder:
    /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/...

    What is needed to compile with ggc for arm with c++11 ?

    When I use the kit destop every things works fine...


  • Moderators

    What is the gcc version you use for ARM?
    QMAKE_CXXFLAGS += -std=C++11 is not needed, CONFIG += c++11 should be enough.



  • I'm using arm-poky-linux-gnueabi-gcc (GCC) 4.8.1 and the sdk/toolchain 1.5
    I should upgrade the toolchain to 2.0?


  • Moderators

    What does

    ldd /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/lib/libboost_system.so
    

    say?



  • I have installed the toolchain 2.0.1 with gcc for arm version 5.2.0.
    Compilation works.
    Now i try to debug on my target, but it seems that dbg don't find boost libraries.
    I have this error when I start debugging I use the boost function:

    Unable to find dynamic linker breakpoint function.
    GDB will be unable to debug shared library initializers
    and track explicitly loaded dynamic code.
    Child exited with status 1
    GDBserver exiting
    Debugging has finished

    dbg on target works fine if I don't use boost function and libraries.
    On the target in the /usr/lib I have all the libboost*.so !!

    Is it missing a setup in the configuration of the dbg ?


Log in to reply
 

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