Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


dyld: lazy symbol binding failed: __ZN2cv17CascadeClassifier4loadERKSs #87

dustinwtf opened this Issue · 18 comments

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);

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


I'm getting the same issue with homebrew installed opencv when trying to run the copterface (on OS X 10.9)


bumped into the same issue with video writing (for my own c++ native module which links to opencv). os x 10.9

something definitely changed.

tweaked my opencv formula, made sure to link with ffmpeg libs.
reinstalled everything in homebrew last night.

was working a few days back (not opencv wrapper specific but a common linking error)


checking to see if I can build nodejs with c++11 and libc++ along with all my homebrewed packages (broader issue than just nodejs and opencv)



I've also tried running face_detection.js from the examples folder, and I'm getting a similar error but with a different missing binding:

dyld: lazy symbol binding failed: Symbol not found: __ZN2cv6imreadERKSsi
  Referenced from: /Users/Jim/GitHub/node-opencv/build/Release/opencv.node
  Expected in: dynamic lookup

dyld: Symbol not found: __ZN2cv6imreadERKSsi
  Referenced from: /Users/Jim/GitHub/node-opencv/build/Release/opencv.node
  Expected in: dynamic lookup

Trace/BPT trap: 5```

People are having similar issue with my node module, so I guess it's not node-opencv related. Something is wrong with node-gyp probably.


@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"

2) 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': {
        '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


@victusfate I was able to get the node-protobuf bindings working for me (it had a similar issue) using your xcode_settings.

Unfortunately, I'm a complete know-nothing on this detail, and might have done something terrible / incorrect for that module in the process.

Any chance you can explain some of your flag choices, and which you think might be most important in resolving this sort of problem?


@mshick unfortunately I haven't worked with node-protobuf, nor tried variations of skipping c++11 or skipping libc++ (I wanted features from the former, and consistent usage of the latter across all my built binaries).

if you're having a problem specifically with node-protobuf I'd start with modifying it's binding.gyp until you can get it to install, and pass any tests. In addition perhaps the protobuf brew package(?) may need similar trades done to see what's essential to getting that to install and test successfully.

just to make it clear, I link from opencv using my own node module, not node-opencv (so I don't have the same constraints/dependencies). Maybe you can remove the dependency and get it to function properly by editing/commenting out it's usage in the node-opencv module.


Same issue, what's the fix? Cheers
I'm using OSX Mavericks, and brew installed opencv, and brew installed python.
Have tried removing and trying again... nada.

@peterbraden peterbraden referenced this issue from a commit
@peterbraden Fix for mavericks / homebrew re #87
Basically just copying solution from mshick/node-protobuf@a071e79

Actually have no idea _why_ this works - assume there's some intricacies with xcode on mavericks.

Finally had some time to look into this - I think this should fix it, but it's a really obscure issue - I basically just copied @mshick 's fix.

Lemme know if there's still issues.

(npm published as 0.4)


Nice @peterbraden I bumped into this when getting my own opencv node module working when Mavericks first went live. It's not that obscure, but it is a significant change to the c++ standard libraries made on Apple's behalf. You can use the old std libs or the new Apple ones. Using the new libraries consistently got everything working for me locally.

Great work @mshick , glad you got your setup cooking.


A cleaner approach is to put this in the .gyp file:

'xcode_settings': {


@tlbtlbtlb incorporating your suggestion and paring down all those compilation settings to a minimum:



I am getting this now, too, even having edited the bindings.gyp file.. :(

@thlorenz thlorenz referenced this issue in rvagg/node-levelup

dyld: lazy symbol binding failed #240


this is how i solved the issue on my machine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.