由于OpenCV 2.4.11没有为Visual Studio 2008 x64提供预构建的库,我尝试(不成功)通过使用CMake 3.2.2生成VC9 x64项目来自己构建它们。
跟踪VC的输出,发现问题来自于 opencv_core
。当构建它时,我得到以下错误:
3>..........sourcesmodulescoresrcsystem.cpp(257) : error C3861: '__cpuidex': identifier not found
我如何解决这个问题,以便在VC9 x64上构建(最好是静态) OpenCV 2.4.11库?
顺便说一句,我用的是Windows 7 ultimate SP1 x64。
以下是visual studio在构建opencv_core
时的完整输出:
1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Deleting intermediate and output files for project 'ZERO_CHECK', configuration 'Debug|x64'
1>Checking Build System
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/3rdparty/zlib/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/3rdparty/libtiff/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/3rdparty/libjpeg/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/3rdparty/libjasper/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/3rdparty/libpng/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/include/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/androidcamera/.androidcamera/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/calib3d/.calib3d/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/contrib/.contrib/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/core/.core/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/dynamicuda/.dynamicuda/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/features2d/.features2d/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/flann/.flann/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/gpu/.gpu/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/highgui/.highgui/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/imgproc/.imgproc/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/java/.java/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/legacy/.legacy/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/ml/.ml/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/nonfree/.nonfree/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/objdetect/.objdetect/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/ocl/.ocl/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/photo/.photo/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/python/.python/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/stitching/.stitching/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/superres/.superres/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/ts/.ts/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/video/.video/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/videostab/.videostab/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/viz/.viz/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/world/.world/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/core/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/flann/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/imgproc/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/highgui/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/features2d/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/calib3d/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/ml/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/video/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/legacy/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/objdetect/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/photo/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/gpu/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/nonfree/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/contrib/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/stitching/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/superres/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/ts/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/modules/videostab/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/doc/CMakeFiles/generate.stamp is up-to-date.
1>CMake does not need to re-run because C:/Users/MY_USER_NAME/Downloads/opencv/cmake_build/x64/vc9/data/CMakeFiles/generate.stamp is up-to-date.
1>Build log was saved at "file://c:UsersMY_USER_NAMEDownloadsopencvcmake_buildx64vc9ZERO_CHECK.dirDebugBuildLog.htm"
1>ZERO_CHECK - 0 error(s), 0 warning(s)
2>------ Rebuild All started: Project: zlib, Configuration: Debug x64 ------
2>Deleting intermediate and output files for project 'zlib', configuration 'Debug|x64'
2>Building Custom Rule C:/Users/MY_USER_NAME/Downloads/opencv/sources/3rdparty/zlib/CMakeLists.txt
2>CMake does not need to re-run because C:UsersMY_USER_NAMEDownloadsopencvcmake_buildx64vc93rdpartyzlibCMakeFilesgenerate.stamp is up-to-date.
2>Compiling...
2>adler32.c
2>zutil.c
2>uncompr.c
2>trees.c
2>inffast.c
2>inftrees.c
2>infback.c
2>inflate.c
2>gzwrite.c
2>gzread.c
2>gzlib.c
2>gzclose.c
2>deflate.c
2>crc32.c
2>compress.c
2>Generating Code...
2>Creating library...
2>Build log was saved at "file://c:UsersMY_USER_NAMEDownloadsopencvcmake_buildx64vc93rdpartyzlibzlib.dirDebugBuildLog.htm"
2>zlib - 0 error(s), 0 warning(s)
3>------ Rebuild All started: Project: opencv_core, Configuration: Debug x64 ------
3>Deleting intermediate and output files for project 'opencv_core', configuration 'Debug|x64'
3>Building Custom Rule C:/Users/MY_USER_NAME/Downloads/opencv/sources/modules/core/CMakeLists.txt
3>CMake does not need to re-run because C:UsersMY_USER_NAMEDownloadsopencvcmake_buildx64vc9modulescoreCMakeFilesgenerate.stamp is up-to-date.
3>Compiling...
3>opencv_core_pch.cpp
3>Compiling...
3>tables.cpp
3>system.cpp
3>..........sourcesmodulescoresrcsystem.cpp(257) : error C3861: '__cpuidex': identifier not found
3>stat.cpp
3>rand.cpp
3>persistence.cpp
3>parallel.cpp
3>out.cpp
3>opengl_interop_deprecated.cpp
3>opengl_interop.cpp
3>matrix.cpp
3>matop.cpp
3>matmul.cpp
3>mathfuncs.cpp
3>lapack.cpp
3>gpumat.cpp
3>gl_core_3_1.cpp
3>glob.cpp
3>dxt.cpp
3>drawing.cpp
3>datastructs.cpp
3>Generating Code...
3>Compiling...
3>copy.cpp
3>convert.cpp
3>cmdparser.cpp
3>array.cpp
3>arithm.cpp
3>alloc.cpp
3>algorithm.cpp
3>Generating Code...
3>Build log was saved at "file://c:UsersMY_USER_NAMEDownloadsopencvcmake_buildx64vc9modulescoreopencv_core.dirDebugBuildLog.htm"
3>opencv_core - 1 error(s), 0 warning(s)
========== Rebuild All: 2 succeeded, 1 failed, 0 skipped ==========
最后,我还为Visual Studio 2013生成了另一个项目,但这次构建成功了…
今天我遇到了同样的问题。我碰巧在谷歌上看到了你的问题。
我有两个桌面VS 2008;我用的前一个似乎还可以(我稍后会检查一下,暂时不在手边),但我现在用的那个就是不能用。
我唯一能记得的是,你的VS 2008有sp1升级吗?如果我没记错的话,我在以前的电脑上安装了SP1包。我将在检查之前的设置后评论或更新答案。
/*其他消息*/
是,请安装SP1再试一次!希望你能来!