3

我无法在 Mavericks 上构建带有 cuda 支持的 opencv:当使用 cmake -G "Unix Makefiles" -DWITH_CUDA=ON ..

我收到错误:- 配置不完整,发生错误!

有什么解决方法吗?(使用 macport 时也出现类似错误)

CMakeError.log

Determining size of off64_t failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec3929617441/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec3929617441.dir/build.make CMakeFiles/cmTryCompileExec3929617441.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3929617441.dir/OFF64_T.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec3929617441.dir/OFF64_T.c.o   -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:19:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
  ('0' + ((SIZE / 10000)%10)),
           ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
                     ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:20:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
  ('0' + ((SIZE / 1000)%10)),
           ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
                     ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:21:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
  ('0' + ((SIZE / 100)%10)),
           ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
                     ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:22:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
  ('0' + ((SIZE / 10)%10)),
           ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
                     ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:23:12: error: use of undeclared identifier 'off64_t'; did you mean 'off_t'?
  ('0' +  (SIZE    % 10)),
           ^
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:17:22: note: expanded from macro 'SIZE'
#define SIZE (sizeof(off64_t))
                     ^
5 errors generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec3929617441.dir/OFF64_T.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec3929617441/fast] Error 2

/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CheckTypeSize/OFF64_T.c:
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>


#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif

#define SIZE (sizeof(off64_t))
char info_size[] =  {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
  ('0' + ((SIZE / 10000)%10)),
  ('0' + ((SIZE / 1000)%10)),
  ('0' + ((SIZE / 100)%10)),
  ('0' + ((SIZE / 10)%10)),
  ('0' +  (SIZE    % 10)),
  ']',
#ifdef KEY
  ' ','k','e','y','[', KEY, ']',
#endif
  '\0'};

#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
  int require = 0;
  require += info_size[argc];
  (void)argv;
  return require;
}


Determining if the include file io.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec647810530/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec647810530.dir/build.make CMakeFiles/cmTryCompileExec647810530.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec647810530.dir/CheckIncludeFile.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec647810530.dir/CheckIncludeFile.c.o   -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'io.h' file not found
#include <io.h>
         ^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec647810530.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec647810530/fast] Error 2


Determining if the function jbg_newlen exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec4172827471/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec4172827471.dir/build.make CMakeFiles/cmTryCompileExec4172827471.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec4172827471.dir/CheckFunctionExists.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -DCHECK_FUNCTION_EXISTS=jbg_newlen -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec4172827471.dir/CheckFunctionExists.c.o   -c /opt/local/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec4172827471
/opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec4172827471.dir/link.txt --verbose=1
/usr/bin/cc     -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3 -DCHECK_FUNCTION_EXISTS=jbg_newlen -O3 -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTryCompileExec4172827471.dir/CheckFunctionExists.c.o  -o cmTryCompileExec4172827471  
Undefined symbols for architecture x86_64:
  "_jbg_newlen", referenced from:
      _main in CheckFunctionExists.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [cmTryCompileExec4172827471] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec4172827471/fast] Error 2


Determining if the include file linux/videodev.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec70111243/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec70111243.dir/build.make CMakeFiles/cmTryCompileExec70111243.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec70111243.dir/CheckIncludeFile.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec70111243.dir/CheckIncludeFile.c.o   -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'linux/videodev.h' file not found
#include <linux/videodev.h>
         ^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec70111243.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec70111243/fast] Error 2


Determining if the include file linux/videodev2.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec661389614/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec661389614.dir/build.make CMakeFiles/cmTryCompileExec661389614.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec661389614.dir/CheckIncludeFile.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec661389614.dir/CheckIncludeFile.c.o   -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'linux/videodev2.h' file not found
#include <linux/videodev2.h>
         ^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec661389614.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec661389614/fast] Error 2


Determining if the include file sys/videoio.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec741892054/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec741892054.dir/build.make CMakeFiles/cmTryCompileExec741892054.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec741892054.dir/CheckIncludeFile.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec741892054.dir/CheckIncludeFile.c.o   -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'sys/videoio.h' file not found
#include <sys/videoio.h>
         ^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec741892054.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec741892054/fast] Error 2


Determining if the include file libavformat/avformat.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec2161613468/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec2161613468.dir/build.make CMakeFiles/cmTryCompileExec2161613468.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2161613468.dir/CheckIncludeFile.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec2161613468.dir/CheckIncludeFile.c.o   -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'libavformat/avformat.h' file not found
#include <libavformat/avformat.h>
         ^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec2161613468.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec2161613468/fast] Error 2


Determining if the include file ffmpeg/avformat.h exists failed with the following output:
Change Dir: /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp

Run Build Command:/opt/local/bin/gmake "cmTryCompileExec188285781/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec188285781.dir/build.make CMakeFiles/cmTryCompileExec188285781.dir/build
gmake[1]: Entering directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
/opt/local/bin/cmake -E cmake_progress_report /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec188285781.dir/CheckIncludeFile.c.o
/usr/bin/cc   -fsigned-char -W -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -fno-omit-frame-pointer -msse -msse2 -msse3  -O3 -DNDEBUG   -o CMakeFiles/cmTryCompileExec188285781.dir/CheckIncludeFile.c.o   -c /Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'ffmpeg/avformat.h' file not found
#include <ffmpeg/avformat.h>
         ^
1 error generated.
gmake[1]: *** [CMakeFiles/cmTryCompileExec188285781.dir/CheckIncludeFile.c.o] Error 1
gmake[1]: Leaving directory `/Users/caominhvu/Downloads/opencv-2.4.7/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTryCompileExec188285781/fast] Error 2
4

2 回答 2

1

以下是我使用 Xcode 5.0.2 和 CUDA 5.5 在 OSX Mavericks 10.9.1 上编译 OpenCV 2.4.8 的方法:

  • 打开CMake设置项目,并进行基本配置
  • 在最新的Xcode(我认为> = 5)中不再有gcc编译器,不推荐使用clang,所以转到CMAKE项目的CUDA选项并将CUDA_HOST_COMPILER更改为使用“/usr/bin/clang”。幸运的是 CUDA 5.5 支持 clang 而不仅仅是 gcc
  • 显然 CUDA 5.5 仅支持较旧的 libstdc++ 库而不支持更现代的 libc++,因此更新 CUDA_NVCC_FLAGS 以告诉 mvcc 通过告诉 nativa 编译器使用这个较旧的库。添加“-Xcompiler -stdlib=libstdc++;-Xlinker -stdlib=libstdc++”
  • 还告诉 C++ 编译器编译库的其余部分以使用 libstdc++:显示 CMAKE 的高级选项并转到 CMAKE 将“-stdlib=libstdc++”添加到 CMAKE_CXX_FLAGS 和 CMAKE_EXE_LINKER_FLAGS
于 2014-01-28T18:06:17.813 回答
0

对于以后可能会尝试从本教程进行安装的任何人。我遇到了这个问题,因为我的 OPENCV_EXTRA_MODULES_PATH 指向了错误的目录。我在 ~/src/ 中有我的,而不仅仅是 ~/

于 2017-08-30T18:14:31.273 回答