node-opencv: dyld: lazy symbol binding failed: __ZN2cv17CascadeClassifier4loadERKSs

Getting this error:

dyld: lazy symbol binding failed: Symbol not found: __ZN2cv17CascadeClassifier4loadERKSs
  Referenced from: /Users/dustin/worker/node_modules/opencv/build/Release/opencv.node
  Expected in: dynamic lookup

dyld: Symbol not found: __ZN2cv17CascadeClassifier4loadERKSs
  Referenced from: /Users/dustin/worker/node_modules/opencv/build/Release/opencv.node
  Expected in: dynamic lookup

Trace/BPT trap: 5

I’m basically running the example for face detection from the README.

cv.readImage(img.originalBuffer, function(err, im) {

    im.detectObject(cv.FACE_CASCADE, {}, function(err, faces) {
        console.log(err, faces);

        for (var i = 0; i < faces.length; i++) {
            var x = faces[i];
            im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2);
        }

        im.save('/Users/dustin/out.jpg');
    });
});

My version of opencv is 2.4.6.1 and it was installed with homebrew. If there’s anything else I should provide, let me know.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@fuwaneko I was able to link aok with opencv after performing the following steps (not sure if all are necessary)

  1. modify my homebrew installations to include the following:
args << "CC=clang"
args << "CXX=clang++"
args << "CXXFLAGS=-O3 -stdlib=libc++"
args << "LIBS=-lc++ -lc++abi"
  1. modify my node-gyp files to include the following section:
'conditions': [
  ['OS=="mac"', {
    'libraries': [
      '<!@(pkg-config --libs <#any necessary packages>)',
      '-framework OpenCL',
      '-lc++ -lc++abi'            
    ],
    'xcode_settings': {
        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
        'OTHER_CFLAGS': [ '-g', '-mmacosx-version-min=10.7', '-std=c++11', '-stdlib=libc++', '-O3', '-D__STDC_CONSTANT_MACROS', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-Wall' ],
        'OTHER_CPLUSPLUSFLAGS': [ '-g', '-mmacosx-version-min=10.7', '-std=c++11', '-stdlib=libc++', '-O3', '-D__STDC_CONSTANT_MACROS', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-Wall' ]
    }
  }]
]

this forced all my c++ tools to use c++11 and libc++, as well as node-gyp to link using the same libraries