在使用luarocks安装fbtorch时,Cmake无法识别FOLLY_LIBRARIES的缓存条目

时间:2017-11-22 06:09:40

标签: cmake luarocks

我正在尝试在linux上安装fbtorch。但是,当我尝试运行luarocks install fbtorch时,我收到以下错误。

cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/user/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/user/torch/install/lib/luarocks/rocks/fbtorch/scm-1"

fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /home/user/torch/install
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  REQUIRED_ARGS (missing: FOLLY_INCLUDE_DIR FOLLY_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindFolly.cmake:23 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:12 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
See also "/tmp/luarocks_fbtorch-scm-1-4920/fbtorch/build/CMakeFiles/CMakeOutput.log".

现在,要修复REQUIRED_ARGS (missing: FOLLY_INCLUDE_DIR FOLLY_LIBRARIES),我将cmake命令更改为:

cmake -E make_directory build && cd build && cmake .. -DFOLLY_LIBRARIES="/home/user/local/lib" -DFOLLY_INCLUDE_DIR="/home/user/local/include" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." -DCMAKE_INSTALL_PREFIX="$(PREFIX)"
  

请注意,我已在/home/user/local/的适当目录中编译并安装folly

这解决了FOLLY_INCLUDE_DIR错误,但仍然显示FOLLY_LIBRARIES错误,如此:

CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  REQUIRED_ARGS (missing: FOLLY_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindFolly.cmake:23 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:12 (FIND_PACKAGE)

我在这里缺少什么?为什么cmake识别FOLLY_INCLUDE_DIR的缓存条目而不识别FOLLY_LIBRARIES的缓存条目?

2 个答案:

答案 0 :(得分:1)

find_package()来电中“错过”列表中列出的变量不需要 CACHE 。因此,设置具有相同名称的缓存变量可能无法解决问题。

如果搜索的包实际安装到非标准位置,而不是盲目设置“缺失”变量,最好提示关于该位置的“查找”脚本

许多“查找”脚本在代码开头描述了可能的参数化方法。除此之外,还有常用方法用于提示关于包的实际位置的“查找”脚本;这些方法适用于大多数脚本。例如。您可以将包的安装位置添加到 CMAKE_PREFIX_PATH 变量中(参见that question)。

答案 1 :(得分:-1)

如果你看FindFolly.cmake,你可以看到这一行 -

SET(FOLLY_LIBRARIES ${FOLLY_LIBRARY})

这意味着FOLLY_LIBRARIES已设置,但需要FOLLY_LIBRARY

因此,在命令行中将-DFOLLY_LIBRARIES更改为-DFOLLY_LIBRARY