dyld: lazy symbol binding failed: Symbol not found: Expected in: flat namespace

1.2k Views Asked by At

I recently updated OpenCv to version 3.2.0 and had to rewrite a few of my JNI wrappers as a result. However, now it is throwing me this error:

dyld: lazy symbol binding failed: Symbol not found: 
ZN2cv4MSER6createEiiiddiddi
  Referenced from: /Users/kve/Documents/Projects/NU/bot/JDA/libs/libmser.dylib
  Expected in: flat namespace

dyld: Symbol not found: __ZN2cv4MSER6createEiiiddiddi
  Referenced from: /Users/kve/Documents/Projects/NU/bot/JDA/libs/libmser.dylib
  Expected in: flat namespace

This is a result of me using the MSER::create function. I have tried returning the address of a new Mat and it presented no errors, so I believe that this is not related to similar errors others have been experiencing with relation to MacOS and dylibs (i.e. others had problems loading the library in general, whereas mine is only with MSER::create). Trust me, I've been searching online for at least 2 hours for a solution to this and I can't find one.

Here is the relevant code from my MSER.cpp file:

JNIEXPORT jlong JNICALL Java_org_opencv_features2d_MSER_create_11(JNIEnv* env, jclass cls, jint delta, jint min_area, jint max_area, jdouble max_variation, jdouble min_diversity, jint max_evolution, jdouble area_threshold, jdouble min_margin, jint edge_blur_size)
{
    static const char method_name[] = "MSSR::create_1";

    Ptr<Feature2D> pointer = MSER::create(delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold, min_margin, edge_blur_size);
    MSER* mser = pointer.dynamicCast<MSER>();
    jlong addr = reinterpret_cast<jlong>(mser);

    return addr;
}

And the code for the JNI wrapper:

package org.opencv.features2d;

import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.MatOfRect;

import java.io.File;

public class MSER extends FeatureDetector{
    static {
        System.load(new File("libs/libmser.dylib").getAbsolutePath());
    }

    public MSER(long addr) {
        super(addr);
    }

    //          MSER( int _delta=5, int _min_area=60, int _max_area=14400, double _max_variation=0.25, double _min_diversity=.2,
    // C++:     int _max_evolution=200, double _area_threshold=1.01,
    //          double _min_margin=0.003, int _edge_blur_size=5 )

    public MSER(int delta, int minArea, int maxArea, double maxVariation, double minDiversity, int maxEvolution, double areaThreshold, double minMargin, int edgeBlurSize) {
        super(create_1(delta, minArea, maxArea, maxVariation, minDiversity, maxEvolution, areaThreshold, minMargin, edgeBlurSize));
    }


    public MSER() {
        this(5, 60, 14400, 0.25, .2, 200, 1.01, 0.003, 5);
    }

    public void detectRegions(Mat image, MatOfKeyPoint msers, MatOfRect bboxes) {
        detectRegions_0(nativeObj, image.nativeObj, msers.nativeObj, bboxes.nativeObj);
    }

    private static native long create_1(int delta, int minArea, int maxArea, double maxVariation, double minDiversity, int maxEvolution, double areaThreshold, double minMargin, int edgeBlurSize);

    private native void detectRegions_0(long nativeObj, long image_nativeObj, long msers_nativeObj, long bboxes_nativeObj);
}

Any help would be appreciated!

Thanks,
Kira

0

There are 0 best solutions below