linux - 在 Linux 上安装 OSVR - 设置二进制目录

标签 linux cmake debian osvr

我目前正在尝试安装 OSVR-Core在我的 Debian 9.1 系统上。我安装了所有先决条件并遵循 this教程。现在我坚持做这个项目。我创建了一个构建目录并尝试运行

cmake -DCMAKE_PREFIX_PATH="/usr/local/stow/libfunctionality"~/src/OSVR-Core

但我得到错误,我的二进制目录应该与我的源目录不同。我的源目录(带有 make 文件)应该是 ~/src/OSVR-Core,因为我在 ~/src/OSVR-Core/build 中,所以我认为这就足够了。

如何(以及在​​哪里)更改二进制目录的位置?我尝试了命令行选项 -D CMAKE_BINARY_DIR= "path/to/OSVR-Core/build 但这没有用。我在网上看到,你不应该手动设置二进制目录,但是它被创建/计算。

这是 CMakeError.log 文件:

    Determining if the pthread_create exist failed with the following output:
Change Dir: /home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_42e59/fast"
/usr/bin/make -f CMakeFiles/cmTC_42e59.dir/build.make CMakeFiles/cmTC_42e59.dir/build
make[1]: Entering directory '/home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_42e59.dir/CheckSymbolExists.c.o
/usr/bin/cc     -o CMakeFiles/cmTC_42e59.dir/CheckSymbolExists.c.o   -c /home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_42e59
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_42e59.dir/link.txt --verbose=1
/usr/bin/cc       CMakeFiles/cmTC_42e59.dir/CheckSymbolExists.c.o  -o cmTC_42e59 -rdynamic 
CMakeFiles/cmTC_42e59.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x1b): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_42e59.dir/build.make:97: recipe for target 'cmTC_42e59' failed
make[1]: *** [cmTC_42e59] Error 1
make[1]: Leaving directory '/home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_42e59/fast' failed
make: *** [cmTC_42e59/fast] Error 2

File /home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_f2984/fast"
/usr/bin/make -f CMakeFiles/cmTC_f2984.dir/build.make CMakeFiles/cmTC_f2984.dir/build
make[1]: Entering directory '/home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_f2984.dir/CheckFunctionExists.c.o
/usr/bin/cc    -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_f2984.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.7/Modules/CheckFunctionExists.c
Linking C executable cmTC_f2984
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f2984.dir/link.txt --verbose=1
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create    CMakeFiles/cmTC_f2984.dir/CheckFunctionExists.c.o  -o cmTC_f2984 -rdynamic -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_f2984.dir/build.make:97: recipe for target 'cmTC_f2984' failed
make[1]: *** [cmTC_f2984] Error 1
make[1]: Leaving directory '/home/lenala/src/OSVR-Core/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_f2984/fast' failed
make: *** [cmTC_f2984/fast] Error 2

最佳答案

你用过吗

cmake .. -DJSONNCPP_WITH_CMAKE_PACKAGE=ON -DJSONNCPP_LIB_BUILD_SHARED=OFF -DCMAKE_CXX_FLAGS=-fPIC

因为这就是教程所说的用于构建项目的内容,并且 CMakaList.txt 将处理所有路径。

关于linux - 在 Linux 上安装 OSVR - 设置二进制目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45694003/

相关文章:

c - (CLion/CMake) 为什么我的 c 文件保存在项目目录中时不属于任何目标项目?

html - 如何制作 HTML 页面(jpeg、png 等)的屏幕截图?

php - 如何启用 IMAP 模块

regex - 我可以在 sed 中提到从不同模式到其他模式的反向引用吗

python - 无法找到模块,即使它已安装并且可以运行

python - 乘客停止杀死孤儿进程

shell - 从当前用户运行 Debian 软件包脚本中的一些命令

python - 在 Python 中创建环境变量似乎不起作用

python - Cython、CMake 和 setup.py、python 在子目录中编译两次

c++ - 使 fatal error : boost/fusion/iterator/equal_to. hpp 没有这样的文件或目录