2012-07-27 52 views
0

我试图在OS X 10.6.8上构建OpenCV。我下载了源代码,然后创建了一个构建目录,然后运行ccmake进行配置,然后cmake。当我运行make,我得到下面的输出:尝试在os上构建opencv的错误x

[laptop] build$ pwd 
/Users/jesse.aldridge/OpenCV-2.4.2/build 
[laptop] build$ make 
... 
[ 92%] Built target opencv_perf_photo_pch_dephelp 
[ 92%] Built target pch_Generate_opencv_perf_photo 
[ 93%] Built target opencv_perf_photo 
[ 93%] Built target opencv_test_photo_pch_dephelp 
[ 94%] Built target pch_Generate_opencv_test_photo 
[ 94%] Built target opencv_test_photo 
Linking CXX shared library ../../lib/cv2.so 
Undefined symbols for architecture x86_64: 
    "_PyGILState_Ensure", referenced from: 
     OnMouse(int, int, int, int, void*)in cv2.cpp.o 
     OnChange(int, void*)in cv2.cpp.o 
     NumpyAllocator::allocate(int, int const*, int, int*&, unsigned char*&, unsigned char*&, unsigned long*)in cv2.cpp.o 
     NumpyAllocator::deallocate(int*, unsigned char*, unsigned char*)in cv2.cpp.o 
    "_PyGILState_Release", referenced from: 
     OnMouse(int, int, int, int, void*)in cv2.cpp.o 
     OnChange(int, void*)in cv2.cpp.o 
     NumpyAllocator::allocate(int, int const*, int, int*&, unsigned char*&, unsigned char*&, unsigned long*)in cv2.cpp.o 
     NumpyAllocator::deallocate(int*, unsigned char*, unsigned char*)in cv2.cpp.o 

    ...a bunch of similar errors 

我没有很多的经验与C++,所以我不知道这是什么错误是怎么一回事。有小费吗?

下面是完整的输出:https://gist.github.com/3190726

回答

1

一旦你在你的build目录里,这里的命令:

cmake -G "Unix Makefiles" .. 
make -j8 
sudo make install 

这就是一直为我工作。不要忘记cmake命令末尾的两个点。先尝试一下,如果它可以工作,你可以尝试改变ccmake中的选项。你不应该在cmake之前运行ccmake。这只是cmake的一个交互式前端。如果您使用ccmake生成make文件,则不应运行cmake。只需从ccmake直接进行即可。