Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Plugin depending on another library - Couldn't open <library>, error: undefined symbol

Discussion in 'Linux' started by MrMallIronmaker37, Jun 23, 2017.

  1. MrMallIronmaker37

    MrMallIronmaker37

    Joined:
    Jun 23, 2017
    Posts:
    2
    I've been banging my head against this bug and making incremental progress. It's similar to a recent forum post [https://forum.unity3d.com/threads/u...rd-party-library-dllnotfoundexception.467175/] but the fix Tak suggested isn't working for me. It's about as likely that that problem is coming from Unity as any other part of my build process, but I'm hoping someone can help out here.

    The error:

    Couldn't open Assets/Plugins/libopencv_unity.so, error: Assets/Plugins/libopencv_unity.so: undefined symbol: _ZN2cv12VideoCaptureD1Ev
    OpenCVFaceDetection:Start() (at Assets/OpenCVFaceDetection.cs:43)
    OpenCVFaceDetection:Start() (at Assets/OpenCVFaceDetection.cs:23)


    Just as in the thread linked above, the library I'm referencing has the right symbol, and it's in the Assets/Plugins/ directory:

    mark@isidore-seville:~/miniprojects/unity/wrapping/Assets/Plugins$ nm libopencv_videoio.so | grep _ZN2cv12VideoCaptureD1Ev
    0000000000007ac0 T _ZN2cv12VideoCaptureD1Ev

    However, I've made the change to the library I built [which references opencv_videoio] to set the RPATH as $ORIGIN:

    mark@isidore-seville:~/miniprojects/unity/wrapping/Assets/Plugins$ objdump -x libopencv_unity.so | grep RPATH
    RPATH $ORIGIN


    and yet I still get the same error as above. Any tips? I'm fairly new to Unity, especially plugins - maybe I've got the plugins in the wrong place?

    Mark
     
  2. MrMallIronmaker37

    MrMallIronmaker37

    Joined:
    Jun 23, 2017
    Posts:
    2
    Found the solution! My ldd output didn't refer to any sort of other library, and I had expected the library creation step to error out if I needed to link against the OpenCV libraries [just as it would if I were linking some of my own C++ code]. I was using CMake and it turns out I needed to add the "target_link_libraries" option to link against OpenCV.
     
    knobby67 likes this.
  3. heoran1209

    heoran1209

    Joined:
    Jun 29, 2020
    Posts:
    1
    증거 8.PNG

    What do you think of this error? Any one on earth is fine, so please tell me how to solve this error quickly!