CMAKE找不到OpenNI
我一直在尝试使用 Kinect 库运行“入门教程”(http://nicolas.burrus.name/index.php/Research/KinectUseNestk),但我偶然发现了一个错误。
当我在 CLI 中尝试以下行时:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
我收到以下错误:
CMake Error at D:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHan
dleStandardArgs.cmake:91 (MESSAGE):
Could NOT find OpenNI (missing: OPENNI_LIBRARY OPENNI_INCLUDE_DIR)
Call Stack (most recent call first):
D:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardAr
gs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
nestk/cmake/FindOpenNI.cmake:51 (find_package_handle_standard_args)
nestk/cmake/find_nestk_deps.cmake:77 (FIND_PACKAGE)
build/nestk/UseEmbeddedNestk.cmake:23 (INCLUDE)
nestk/CMakeLists.txt:67 (INCLUDE)
有人知道我必须如何解决这个问题吗?我已经安装了 OpenNI,它安装在 D:\Program Files\OpenNI。
I’ve been trying to run the “tutorial to get started” with the Kinect libraries (http://nicolas.burrus.name/index.php/Research/KinectUseNestk) but I stumbled across an error.
When I try the following line in the CLI:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
I get the following error:
CMake Error at D:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHan
dleStandardArgs.cmake:91 (MESSAGE):
Could NOT find OpenNI (missing: OPENNI_LIBRARY OPENNI_INCLUDE_DIR)
Call Stack (most recent call first):
D:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardAr
gs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
nestk/cmake/FindOpenNI.cmake:51 (find_package_handle_standard_args)
nestk/cmake/find_nestk_deps.cmake:77 (FIND_PACKAGE)
build/nestk/UseEmbeddedNestk.cmake:23 (INCLUDE)
nestk/CMakeLists.txt:67 (INCLUDE)
Does anyone have any idea how I have to solve this? I’ve installed OpenNI, it’s installed at D:\Program Files\OpenNI.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要使用 CMAKE 构建 OpenNI 项目,您可以将其写入 cmakelists 中。效果很好。 (我还包括了 NITE2,但如果您不需要,只需删除这些行)。
之后您需要链接找到的目录和库:
For biulding an OpenNI project with CMAKE you can wirte this in your cmakelists. It works fine. (I also included NITE2, but if you don't needed just delete those lines).
And later you need to link the directories and libs found:
您可以尝试修改 CMakeLists.txt 文件并添加或修改以下行,
否则,请在二进制文件夹中查找名为 CMakeCache.txt 的文件。查找 OPENNI_INCLUDE_DIR 和 OPENNI_LIB_DIR,设置正确的路径,然后再次运行 cmake。
如果这些都不起作用,并且您可以运行 cmake-gui,请尝试使用它而不是 cli 命令并在 GUI 中手动指定这些路径。
我希望它有帮助!
You could try to modify the CMakeLists.txt file and add or modify the following lines
Otherwise, look for a file named CMakeCache.txt inside the binaries folder. Look for OPENNI_INCLUDE_DIR and OPENNI_LIB_DIR, set the right path, and run cmake again.
If none of those work, and you can run cmake-gui, try to use it instead of the cli command and manually specify those paths in the GUI.
I hope it helps!
确保 OPEN_NI_BIN、OPEN_NI_INCLUDE、OPEN_NI_INSTALL_PATH 环境变量均已设置并且它们指向正确的位置,因为检查 OPEN_NI 的 cmake 模块会检查这些值。
我遇到了同样的错误,但就我而言,这是混合 64 位和 32 位库的问题。我使用 32 位编译器构建 opencv,但 OpenNI 是 64 位。所以我卸载了所有 64 位版本,只留下 32 位版本,这使它可以工作。
亲切的问候,
丹尼尔
Make sure OPEN_NI_BIN, OPEN_NI_INCLUDE, OPEN_NI_INSTALL_PATH environment variables are all set and that they point to the right place, because the cmake module that checks for OPEN_NI checks those values.
I was getting the same error, but in my case, it was a problem mixing 64 and 32 bit libraries. I was building opencv with 32 bit compilers, but OpenNI was 64 bit. So I uninstalled all 64bit and left only 32 bit versions, which made it work.
Kind regards,
Daniel
典型的 openni2 发行版具有以下文件 /OpenNI-Linux-Arm-2.2/OpenNIDevEnvironment
它描述了编译和链接所需的所有变量:
因此您需要导出这些变量,然后在启用 OpenNI2 的情况下运行 cmake:
在 cmake 结果中的某处您应该看到:
-- OpenNI2:是(版本 2.2.0,版本 33)
Typical openni2 distribution has following file /OpenNI-Linux-Arm-2.2/OpenNIDevEnvironment
It has described all necessary variables to compile and link:
So you need to export these variables and then run the cmake with OpenNI2 enabled:
Somewhere in cmake result you should see:
-- OpenNI2: YES (ver 2.2.0, build 33)