[Solved] Cannot find libs for cross-compiling (BBB) while Host PC works fine



  • Hi all,

    this example with projectfile does nothing and works fine on my Host PC (Linux Host 3.13.0-37-generic x86_64 GNU/Linux):

    @#-------------------------------------------------

    Project created by QtCreator 2014-10-13T18:43:25

    #-------------------------------------------------

    QT += core
    QT -= gui

    TARGET = Marker-Test
    target.files = Marker-Test
    target.path = /home/ubuntu/workspace/temp
    INSTALLS += target

    TARGET = Marker-Test
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp \

    INCLUDEPATH += /usr/local/opencv-2.4.9/include
    /usr/include/c++/4.8/

    #just an example lib!
    LIBS += -L/usr/lib -lgs@

    This example works finde on my Host. If i compile and run it on my Host PC for my BeagleboneBlack, sometimes there is an error but not allways:

    1. error: cannot find -lgs (depends on the libs)
    2. error: collect2: error: ld returned 1 exit status

    How can i solve this problem? If i do not include any lib it works fine on my BBB.

    Thanks
    Bart


  • Lifetime Qt Champion

    Hi,

    Do you have all of these libraries available on the BBB sysroot your are using to build your applications ?



  • Hi,

    on my Host PC:

    1. I installed Qt with the Online Installer
    2. I downloaded qt-everywhere-opensource-src-5.2.1
      2.1 @./configure -v -opensource -confirm-license -prefix /opt/Qt/5.2.1-BBB -xplatform linux-arm-gnueabihf-g++ -device linux-beagleboneblack-g++ -device-option CROSS_COMPILE=/usr/local/linaro/bin/arm-linux-gnueabihf-@
      2.2 make
      2.3 make install
      2.4 I copied the folder to my BBB => /usr/5.2.1-BBB
      2.5 added the PATH in /etc/environment
    3. added on my Host in Qt the "Kits" and "Devices"

    everything works fine and I can develop little progs (read values from IC2 and so on)

    Now I compiled openCV on my Host for the Host and everything works very well (detect something...)

    On my BBB:

    1. I downloaded openCV according to this manual: "http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html":http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
    2. I got these error(s) from first post
    3. I tried to include any lib that exists on my BBB to, like: -L/usr/lib -lgs

    The problem I think is not openCV. The problems are in general.



  • I got the correct linking for INCLUDEPATH and LIBS

    but the error is still there:
    /usr/local/opencv-2.4.9/lib/libopencv_calib3d.so:-1: error: file not recognized: File format not recognized
    error: collect2: error: ld returned 1 exit status


  • Lifetime Qt Champion

    You are giving the wrong paths to the libraries. You can't use your host libraries to link to your cross-compiled software.

    Where are the arm version located ?



  • Yes thanks now I know that this was my problem.
    I cross-compiled openCV with the arm-gnueabi.toolchain.cmake from ~/opencv-2.4.9/platforms/linux and it worked very well.

    Now I did the same with ArUco (this was my original problem) with:

    @cmake -DCMAKE_TOOLCHAIN_FILE=/home/basti/Downloads/aruco-1.2.5/linux/arm-gnueabi.toolchain.cmake -DCMAKE_PREFIX_PATH=/usr/local/opencv-2.4.9-hardfp /home/basti/Downloads/aruco-1.2.5@
    @sudo make -j4@

    and I get this error:
    @make[2]: *** No rule to make target /home/basti/Downloads/opencv-2.4.9/platforms/linux/build_hardfp/lib/libopencv_videostab.so.2.4.9', needed bysrc/libaruco.so.1.2.5'. Stop.
    make[2]: *** Waiting for unfinished jobs....
    [ 45%] Building CXX object src/CMakeFiles/aruco.dir/cameraparameters.cpp.o
    make[1]: *** [src/CMakeFiles/aruco.dir/all] Error 2
    make: *** [all] Error 2@

    Do you know what I am doing wrong?


  • Lifetime Qt Champion

    Are you sure the prefix path is correct ?



  • The prefix path from aruco was correct. The install prefix from opencv was wrong.


Log in to reply
 

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