Copia exacta, a modo de respaldo, del tutorial de Jason Dalton
So for a week now i've been trying to get node-opencv to work on my Mac. I kept getting the dyld: lazy symbol binding failed error when I tried to run the examples. This is how i solved it on my machine. So i'm on OSX 10.8.5.
The first step was to get the latest xcode and xcode command line tools for me this was version 5.1. Next setp is to download the latest cmake. The version I download was 3.0.1. Now I used brew to install opencv. Here are the steps.
brew top homebrew/science
This will tell brew what branch to used for opencv. now you can install it normally
brew install opencv
This will install and build opencv for you in your /usr/local/lib and /usr/local/include. So at this point you can now use opencv with xcode or even python. Now the issue i've found with node-opencv and even with xcode if you don't set it up right is opencv is changing from c to c++ on most of its packages so the calls to opencv from node-opencv is calling the c++ version of the API and you must build your version of node-opencv with the proper compiler. Here is how i did it. Get the latest version of node-opencv with the command
npm install opencv --save-dev
In the directory node_modules/opencv open the binding.gyp file. You will see a OTHER-CFLAGS section in this file. Update the following flags to
['OS=="mac"', {
# cflags on OS X are stupid and have to be defined like this
'xcode_settings': {
'OTHER_CFLAGS': [
"-mmacosx-version-min=10.7",
"-std=gnu++11",
"-stdlib=libstdc++",
'<!@(pkg-config --cflags opencv)'
]
, "GCC_ENABLE_CPP_RTTI": "YES"
, "GCC_ENABLE_CPP_EXCEPTIONS": "YES"
}
}]
Now there is one more issue to fix before you can compile your opencv. /usr/local/Cellar/opencv/2.4.9/include/opencv2/flann/lsh_table.h has a small issue with unordered value. I solved this by changed the line
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# define USE_UNORDERED_MAP 1
#else
to
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# define USE_UNORDERED_MAP 0
#else
Now go back to your opencv and run the command.
node-gyp rebuild
NOTA BY SEB: NO HACE FALTA EJECUTAR ESO, BASTA CON npm install
Now you should be able to run the examples in node-opencv. About the author
Jason Dalton · Dallas, TX ·