Compile new ofxCV addon on Lion/osx

hey I am trying to get the examples to compile of the new ofxCV addon (https://github.com/kylemcdonald/ofxCv) but get the following errors which dont tell me much:

Undefined symbols for architecture i386:
“ofxCv::toOf(cv::Rect_)”, referenced from:
testApp::draw() in testApp.o
“ofxCv::toCv(ofBaseHasPixels_&)”, referenced from:
void ofxCv::convertColor<ofVideoGrabber, ofImage_ >(ofVideoGrabber&, ofImage_&, int)in testApp.o
“ofxCv::resize(ofImage_&, ofImage_&, int)”, referenced from:
testApp::update() in testApp.o
“ofxCv::getTargetChannelsFromCode(int)”, referenced from:
void ofxCv::convertColor<ofVideoGrabber, ofImage_ >(ofVideoGrabber&, ofImage_&, int)in testApp.o

I googled around a bit, and apparently that sort of message means normally means xcode is missing a framework, but all the required addons are there. the new addon looks really tasty and would love to try it out.

Thanks,
Thomas

Looks like you might need to alter the User header search paths? You can open the Project Settings and Build settings and add this to User Header Search Paths:

  
"../../../addons/ofxOpenCv/libs/opencv/include/"  

thanks Joshua for the reply

I tried that but didn’t help. I am on Lion and I do the usual build for 10.6 changes and can compile other apps. I added it to PROJECT and TARGET

If I try to compile other ofxCV examples I get similar errors, only can build the empty example in ofxCV. I am sure its as always something obvious I am missing… here is the full message:

  
  
Ld bin/FaceExampleDebug.app/Contents/MacOS/FaceExampleDebug normal i386  
    cd /Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face  
    setenv MACOSX_DEPLOYMENT_TARGET 10.6  
    /Developer/usr/bin/llvm-g++-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/bin -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/android/armeabi -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/android/armeabi-v7a -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/iphone -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/linux -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/linux64 -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/osx -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/vs2010 -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/win_cb -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/android/armeabi-v7a -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/iphone -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/vs2010 -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/win_cb -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/android/armeabi -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/android/armeabi-v7a -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/iphone -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/linux -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/linux64 -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/osx -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/vs2010 -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/win_cb -F/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/bin -F/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../../libs/glut/lib/osx -filelist /Users/tommi/Library/Developer/Xcode/DerivedData/FaceExample-gfytzcpslprzgcbiyhemcwzzdpwv/Build/Intermediates/FaceExample.build/Debug/FaceExample.build/Objects-normal/i386/FaceExampleDebug.LinkFileList -mmacosx-version-min=10.6 -dead_strip ../../../libs/poco/lib/osx/PocoFoundation.a ../../../libs/poco/lib/osx/PocoNet.a ../../../libs/poco/lib/osx/PocoXML.a ../../../libs/poco/lib/osx/PocoUtil.a ../../../libs/tess2/lib/osx/tess2.a ../../../libs/glew/lib/osx/glew.a ../../../libs/cairo/lib/osx/cairo-script-interpreter.a ../../../libs/cairo/lib/osx/cairo.a ../../../libs/cairo/lib/osx/pixman-1.a ../../../libs/fmodex/lib/osx/libfmodex.dylib ../../../libs/rtAudio/lib/osx/rtAudio.a -framework GLUT /Users/tommi/Documents/of007-github/openFrameworks/libs/openFrameworksCompiled/lib/osx/openFrameworksDebug.a -framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework OpenGL -framework QuickTime -framework AppKit -framework Cocoa -framework IOKit /Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/../../ofxOpenCv/libs/opencv/lib/osx/opencv.a -o /Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/bin/FaceExampleDebug.app/Contents/MacOS/FaceExampleDebug  
  
Undefined symbols for architecture i386:  
  "ofxCv::toOf(cv::Rect_<int>)", referenced from:  
      testApp::draw()     in testApp.o  
  "ofxCv::toCv(ofBaseHasPixels_<unsigned char>&)", referenced from:  
      void ofxCv::convertColor<ofVideoGrabber, ofImage_<unsigned char> >(ofVideoGrabber&, ofImage_<unsigned char>&, int)in testApp.o  
  "ofxCv::resize(ofImage_<unsigned char>&, ofImage_<unsigned char>&, int)", referenced from:  
      testApp::update()     in testApp.o  
  "ofxCv::getTargetChannelsFromCode(int)", referenced from:  
      void ofxCv::convertColor<ofVideoGrabber, ofImage_<unsigned char> >(ofVideoGrabber&, ofImage_<unsigned char>&, int)in testApp.o  
ld: symbol(s) not found for architecture i386  
collect2: ld returned 1 exit status  

The libraries are not linking correctly, but I’m not sure how. Are you linking all the oCV libraries instead of just the ones for OSX 10.7? I see a lot of references to

L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/…/…/ofxOpenCv/libs/opencv/lib/vs2010 -L/Users/tommi/Documents/of007-github/openFrameworks/addons/ofxCv/example-face/…/…/ofxOpenCv/libs/opencv/lib/win_cb

and the rest of the extra libs, that might help?

Hey,

I deleted those references now and only have osx in library paths left, but still the same. I asked on github as well even though that might be the wrong place to ask, hopefully not. many thanks for the help!

Can you post a screenshot of your project with all the folders open or a zip of your project just so I can see how you’ve added all the files? Something is not getting compiled properly but I can’t tell why without seeing.

Thanks Joshua, here is the file:
http://dl.dropbox.com/u/40737/example-face.zip

I also just got a reply on github, but didn’t manage to compile it either with the contours tracking example:
https://github.com/kylemcdonald/ofxCv/issues/10 :

this is just a case of some project files being slightly out of date
as i continue development.

i recommend taking the most recent project file (in this case, contour
tracking example) and copying just the project file over to the
example you’re interested in running.

i’ll write a script to do this soon so it stays more up to date.

Kyle is saying that the projects are out of date. You just need to add all the files in ofxCv/src/ that are missing from the project. Right now the compiler doesn’t know that there are more files to compile and link in. If you look at the ofxCv/src in your project, you’ll see that doesn’t have all the files from the actual folder, so adding them in will fix the errors.

oh my, so stupid of me, missed that completely. Thanks for all the help!

thanks josh :slight_smile:

i just updated all the projects with a small bash script https://github.com/kylemcdonald/ofxCv/blob/master/update-projects.sh

any suggestions/modifications that keep me from needing to add new projects to that script… would be very welcome :slight_smile:

kyle:

  
directories=$(ls addons/ofxCv/examples)  
projects=$(ls addons/ofxCv/examples/*/*.xcodeproj | sed s/\(\.*\).xcodeproj/\1)  

haven’t tested, so probably some \ in the regex is wrong

wowww

i had to hack it a bit because they’re individual directories instead of in an examples/ directory, but i totally get the idea.

  
  
directories=$(ls -1d example*)    
projects=$(ls -1d example*/*.xcodeproj | sed -e 's/example-[^\/]*\/\([^.]*\)\(\.xcodeproj\)/\1/g')  
  

also, it’s just a space-delimited list now instead of an array. how would i change that? some kind of split()?

also, it’s just a space-delimited list now instead of an array. how would i change that? some kind of split()?

i’ve been trying to find a solution for that for ages : ) tell me if you find something. it’s super problematic with paths with spaces mainly, but it’ll work with:

  
  
for [ directory in $directories ]  
do  
    whatever $directory  
done  
  

and then sed the project name individually per directory inside the loop

weird, i don’t have a solution to the split thing so i handled it another way like you suggested https://github.com/kylemcdonald/ofxCv/blob/master/update-projects.sh thanks for the help :slight_smile: