OpenCV + CUDA + OSX (10.8.3)
Hi,
I have been trying to compile OpenCV with CUDA (5.0) enabled on OSX 10.8.3, but ran into some problems.
First compiling it gave me some flag error that could not be found. Apparently CUDA and clang don't go well together. I changed CUDA_HOST_COMPILER to point to my gcc-4.7 binary, but apparently gcc 4.7 and CUDA don't go well together either. After installing gcc-4.5 and letting CUDA compile with that I get a lot further, I then got a lot of errors about uint being undefined, so I defined unsigned as uint in common.hpp. That seemed to fix my CUDA problems, after a long time it continued compiling cpp code and it got stuck linking libopencv_gpu.dylib. I get the following linking error :
Undefined symbols for architecture x86_64:
"std::ctype<char>::_M_widen_init() const", referenced from:
stdDebugOutput(cv::String const&) in cuda_compile_generated_NCV.cu.o
ld: symbol(s) not found for architecture x86_64
I googled this error and could not find many solutions. One solution was to install gcc as universal, which allows it to compile 32 bit too I believe, but this did not fix my error. ps. for clarification, this error is after it is done compiling cuda code and is back to compiling opencv with clang.
ps2. Compiling opencv with gcc is not an option I think since I am using it in ROS and ROS on OSX can pretty much only be compiled with clang.
Thanks in advance!
ps. I tried opencv 2.4.3 and opencv 2.4.5, same result.
edit: building as DEBUG seems to fix this issue, not sure why... if anyone can explain me why or how to properly build in release, I would be very interested.
I spent a couple of days trying to do the same on my macbook in OS 10.8... I ended up installing Ubuntu and doing it from there (was much easier with less bugs and errors). Good luck!
Actually I managed to compile everything now. I ended up adding the flag -fno-inline which apparently solved this issue.
hmmm... interesting... are you sure everything worked? Did u compile stuff that use gpu module? Oh, well. I probably messed something up back then (I'm working on Ubuntu now and it works easier, I think)
Yes even gpu stuff is working, I have been working with the gpu version of warpAffine and detectCascades for a while now :) It is sometimes rather complicated to get something to work natively on OSX, but in my opinion it pays off by not having to use parallels or something.
I'm having the same problem (and in another machine with ubuntu is easy to resolved too but I still want to compile it in Mac). How did you add that flag? in cmake?
Yes in cmake (ccmake to be precise). I added it in CMAKE_CXX_FLAGS. You have to enable advanced mode for that setting to appear. Good luck!