ld warning: lib-xyz, needed by lib-abc – Cross Comp Rasp Pi

Sysprogs forums Forums VisualGDB ld warning: lib-xyz, needed by lib-abc – Cross Comp Rasp Pi

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #577
    Silvio
    Participant

    Hi,

    I’m trying to evaluate VisualGDB. I use VS2012(Update 2) and the latest VisualGDB trial version and would like to cross-compile a project for a raspberry pi device.
    Unfortunately, I have some problems with linking of libraries, especially library dependencies.
    In the project I use the OpenCV library, which was compiled on the raspberry itself. If I build the project, in the log-file the linker misses a OpenCV library, so I added it to the “LIBRARY_NAMES” flag.

    #Additional flags

    LIBRARY_NAMES :=opencv_highgui

    So far so good 🙂

    Now the linker complains missing another library that is needed by the previously added lib:
    … ld.exe : warning : libgtk-x11-2.0.so.0, needed by C:SysGCCraspberryarm-linux-gnueabihfsysrootusrlocalopencvlib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)

    Next, I added the missing library, libgtk-x11-2.0 and compiled again.

    Now the linker misses further libraries that are needed by libgtk-x11-2.0:
    … ld.exe : warning : libopencv_imgproc.so.2.4, needed by C:SysGCCraspberryarm-linux-gnueabihfsysrootusrlocalopencvlib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
    … ld.exe : warning : libgtk-x11-2.0.so.0, needed by C:SysGCCraspberryarm-linux-gnueabihfsysrootusrlocalopencvlib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)

    Is there a way that the linker can find the libraries without adding all “second level” depended libraries? Or do I missing some option?
    I’m afraid this will be otherwise an endless story to insert all libraries by hand 

    Thanks,
    Silvio

    #2438
    ket
    Participant

    Hi,

    Others have reported similar issues (viewtopic.php?f=5&t=2648), you do need to specify the second-level libraries as well. The cross-toolchain linker has issues locating the libraries with the usual root folder not being there and some libraries having absolute path dependencies within them.

    In the past with OpenCV the following library names list was successful:

    LIBRARY_NAMES := pthread rt z jpeg png12 tiff jasper gtk-x11-2.0 gobject-2.0 glib-2.0 avcodec avformat avutil swscale dc1394 opencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann

    Then we also needed to specify some libraries with absolute paths:

    
    SYSROOT := C:/sysgcc/raspberry/arm-linux-gnueabihf/sysroot
    LDFLAGS :=  -Wl,-gc-sections $(SYSROOT)/lib/arm-linux-gnueabihf/librt.so.1 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libpng12.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libgdk-x11-2.0.so.0 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libglib-2.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libv4l1.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libjbig.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libpangocairo-1.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libX11.so.6 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXcomposite.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXdamage.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXfixes.so.3 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libatk-1.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libcairo.so.2 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libgdk_pixbuf-2.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libpangoft2-1.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libpango-1.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libfreetype.so.6 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libffi.so.5 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libxvidcore.so.4 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libx264.so.123 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libvpx.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libvorbisenc.so.2 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libvorbis.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libtheoraenc.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libtheoradec.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libspeex.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libschroedinger-1.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libmp3lame.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libgsm.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libdirac_encoder.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libva.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/librtmp.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libgnutls.so.26 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libbz2.so.1.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libraw1394.so.11 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libusb-1.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXext.so.6 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXrender.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXinerama.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXi.so.6 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXrandr.so.2 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXcursor.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libv4l2.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libgmodule-2.0.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libxcb.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libpixman-1.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libxcb-shm.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libxcb-render.so.0 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libselinux.so.1 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libogg.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/liborc-0.4.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libtasn1.so.3 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libp11-kit.so.0 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libdl.so.2 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libexpat.so.1 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libgcrypt.so.11 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libresolv.so.2 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libpcre.so.3 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libv4lconvert.so.0 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXau.so.6 
    $(SYSROOT)/usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 
    $(SYSROOT)/lib/arm-linux-gnueabihf/libgpg-error.so.0 

    Try the above settings with your project.

    #2439
    Silvio
    Participant

    Hi Ket,

    good work, this solved the problem.

    Thanks very much!

    Some hint for other using this solution:
    remove the last backslash from the last line “$(SYSROOT)/lib/arm-linux-gnueabihf/libgpg-error.so.0 ” (seems a copy typo)

    best wishes,
    Silvio

    #2440
    Silvio
    Participant

    Hi Ket,

    unfortunately there is a little problem if I try to change some make file options via the “VisualGDB Project Properties – > Makefile settings”.
    After hitting the Apply button visual gdb tries to build a test application. During the linking the following error occurs:

    arm-linux-gnueabihf-gcc.exe: error: $(SYSROOT)/lib/arm-linux-gnueabihf/librt.so.1: No such file or directory
    arm-linux-gnueabihf-gcc.exe: error:

    For me that is not a critical problem because a can change the settings directly in the *.mak file, but seems that this is maybe a bug.

    best wihes
    Silvio

    #2441
    ket
    Participant

    Hi,

    Thanks for reporting this. We are planning on adding at least an ignore option to the settings toolchain testing in 4.1.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.