gpt4 book ai didi

c++ - 尝试在 os x 上构建 opencv 时出错

转载 作者:行者123 更新时间:2023-11-28 08:00:09 25 4
gpt4 key购买 nike

我正在尝试在 OS X 10.6.8 上构建 OpenCV。我下载了源代码,然后创建了一个构建目录,然后运行 ​​ccmake 进行配置,然后运行 ​​cmake。当我运行 make 时,我得到以下输出:

[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

最佳答案

进入 build 目录后,以下是命令:

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

这对我来说一直很管用。不要忘记 cmake 命令末尾的两个点。先尝试一下,如果有效,您可以尝试更改 ccmake 中的选项。您不应该在 cmake 之前运行 ccmake。它只是 cmake 的一个交互式前端。如果您使用 ccmake 生成 make 文件,则不应运行 cmake。直接从 ccmake 开始制作。

关于c++ - 尝试在 os x 上构建 opencv 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11696337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com