Results 1 to 4 of 4

Thread: How to resolve library (.so) dependancy ?

  1. #1
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to resolve library (.so) dependancy ?

    Hi,

    I'm using opencv3.3.1 for Linux platform. having tree structure like this below
    .
    |---- bin
    |---- build
    | |---- include
    |----include
    | |---- opencv
    | |---- opencv2
    |---- lib
    | |---- pkgconfig
    | |---- python2.7
    |---- share
    |---- OpenCV

    I have linked all the libraries which is on the path: /lib

    libopencv_calib3d.so libopencv_imgcodecs.so.4.0.0 libopencv_stitching.so.4.0
    libopencv_calib3d.so.4.0 libopencv_imgproc.so libopencv_stitching.so.4.0.0
    libopencv_calib3d.so.4.0.0 libopencv_imgproc.so.4.0 libopencv_superres.so
    libopencv_core.so libopencv_imgproc.so.4.0.0 libopencv_superres.so.4.0
    libopencv_core.so.4.0 libopencv_ml.so libopencv_superres.so.4.0.0
    libopencv_core.so.4.0.0 libopencv_ml.so.4.0 libopencv_videoio.so
    libopencv_features2d.so libopencv_ml.so.4.0.0 libopencv_videoio.so.4.0
    libopencv_features2d.so.4.0 libopencv_objdetect.so libopencv_videoio.so.4.0.0
    libopencv_features2d.so.4.0.0 libopencv_objdetect.so.4.0 libopencv_video.so
    libopencv_flann.so libopencv_objdetect.so.4.0.0 libopencv_video.so.4.0
    libopencv_flann.so.4.0 libopencv_photo.so libopencv_video.so.4.0.0
    libopencv_flann.so.4.0.0 libopencv_photo.so.4.0 libopencv_videostab.so
    libopencv_highgui.so libopencv_photo.so.4.0.0 libopencv_videostab.so.4.0
    libopencv_highgui.so.4.0 libopencv_shape.so libopencv_videostab.so.4.0.0
    libopencv_highgui.so.4.0.0 libopencv_shape.so.4.0 pkgconfig
    libopencv_imgcodecs.so libopencv_shape.so.4.0.0 python2.7
    libopencv_imgcodecs.so.4.0 libopencv_stitching.so
    For linking I have tried with this below,
    Qt Code:
    1. unix|win32: LIBS += -L$${PATHOFDIR}/video -lvideo
    2. INCLUDEPATH += $${PATHOFDIR}/video
    3. DEPENDPATH += $${PATHOFDIR}/video
    4.  
    5. OPENCVLINUXDIR = /home/thirdparty/opencv/opencv_3.3.1
    6.  
    7. INCLUDEPATH += $${OPENCVLINUXDIR}/include
    8. DEPENDPATH += $${OPENCVLINUXDIR}/include
    9.  
    10. LIBS += -L$${OPENCVLINUXDIR}/lib -lopencv_core -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_video -lopencv_videoio -lopencv_videostab
    11.  
    12. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_core.so.4.0
    13. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_core.so.4.0.0
    14. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_calib3d.so.4.0
    15. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_calib3d.so.4.0.0
    16. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_features2d.so.4.0
    17. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_features2d.so.4.0.0
    18. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_flann.so.4.0
    19. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_flann.so.4.0.0
    20. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_highgui.so.4.0
    21. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_highgui.so.4.0.0
    22. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_imgcodecs.so.4.0
    23. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_imgcodecs.so.4.0.0
    24. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_imgproc.so.4.0
    25. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_imgproc.so.4.0.0
    26. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_ml.so.4.0
    27. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_ml.so.4.0.0
    28. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_objdetect.so.4.0
    29. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_objdetect.so.4.0.0
    30. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_photo.so.4.0
    31. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_photo.so.4.0.0
    32. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_shape.so.4.0
    33. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_shape.so.4.0.0
    34. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_stitching.so.4.0
    35. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_stitching.so.4.0.0
    36. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_superres.so.4.0
    37. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_superres.so.4.0.0
    38. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_video.so.4.0
    39. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_video.so.4.0.0
    40. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_videoio.so.4.0
    41. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_videoio.so.4.0.0
    42. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_videostab.so.4.0
    43. dependencies.files += $${OPENCVLINUXDIR}/lib/libopencv_videostab.so.4.0.0
    To copy to clipboard, switch view to plain text mode 

    Please help me out why I'm getting this errors

    Still 2 libraries I'm unable to link, say (libopencv_core.so.4.0, libopencv_videoio.so.4.0), got this below error,
    :-1: warning: libopencv_core.so.4.0, needed by /home/test/UnitTest/../../build/release/modules/video/libvideo.so, not found (try using -rpath or -rpath-link)
    :-1: warning: libopencv_videoio.so.4.0, needed by /home/test/UnitTest/../../build/release/modules/video/libvideo.so, not found (try using -rpath or -rpath-link)
    And additionally getting this below error also,
    /home/thirdparty/opencv/opencv_3.3.1/include/opencv2/core/mat.inl.hpp:511: error: undefined reference to `cv::Mat::updateContinuityFlag()'
    Last edited by npatil15; 6th March 2019 at 10:29.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to resolve library (.so) dependancy ?

    The linux linker is stupid. It only pulls the dependencies it knows about from the libraries as it encounters them in the dependency list.

    So if you have a library that depends on another library, you must list the libraries in the order of their dependency. If libopencv_video depends on libopencv_core, then libopencv_video must be in the dependency list before libopencv_core. Likewise, if libopencv_videoio depends on libopencv_video, it must be in the list before libopencv_video. The linker will then build up a set of dependencies so that by the time it gets to libopencv_core, it can pull in the items from libopencv_core that satisfy all of the dependencies from all of the previous code.

    So in your LIBS command, -lopencv_core should be last, and -lopencv_videoio should come before -lopencv_video.

    By the way, I do not think you should list the full version numbers for the libraries. When a library gets installed, it usually creates symlinks from libXYZ.so to libXYZ.so.4, libXYZ.so.4.0, and libXYZ.so.4.0.0 so that when you link to simply libXYZ.so, the symlinks will pull in the most recent version of the library.

    In your case, the order in which you have added the libraries is probably backwards, and because you list the same library twice, it means the linker is wasting time processing each library twice (because libXYZ.so.4.0 is symlinked to libXYZ.so.4.0.0 so they are really the same library).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to resolve library (.so) dependancy ?

    Hi d_stranz,

    The information you provide is surly added knowledge to me.
    Where as I have tried as you said and multiple ways but still the same error.

    Here is the scenario:
    I have one module developed in QT, say Video module, in which I have uses same libraries and in the same order, their it works pretty well (No Errors or warnings).
    Now I'm doing UnitTest for Video module, and calling method of Video module for test, and done the same configuration in UnitTest as done in Video module (Getting warnings and errors as already explained)

    The warnings I'm getting it seems to be some issue in because of Video Module. Because as I change the order in Video.pro as 1st -lopencv_core and 2nd -lopencv_videoio, then in my UnitTest I got warning first for opencv_core and then videoio. And if I change the order then got the warnings first videoio and then opencv_core.

    So from the observation it looks like the order in UnitTest not affecting it. actually the order in Video module affecting my UnitTest to generate error.

    Hope I'm able to explain the issue

    Thanks

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to resolve library (.so) dependancy ?

    Maybe you should ask about this on the OpenCV forum. It sounds like there is a circular dependency between the two libraries. I cannot believe that this would be true for such a popular framework as OpenCV, so maybe your problem has something to do with a function of the same name in two different namespaces.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. How to resolve QLibrary issue
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 28th August 2014, 22:24
  2. How to resolve this error in Windows 8?
    By Gokulnathvc in forum Newbie
    Replies: 3
    Last Post: 28th February 2013, 07:32
  3. Cannot resolve the symbols from a custom dll
    By magpielover in forum Installation and Deployment
    Replies: 4
    Last Post: 22nd August 2011, 21:55
  4. Can somebody resolve this issue???
    By im_rajya in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2006, 11:37
  5. Auto resolve in QFileDialog
    By Levon Nikoghosyan in forum Qt Programming
    Replies: 1
    Last Post: 29th November 2006, 12:15

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.