【问题标题】:Building FLANN with Cmake fails使用 Cmake 构建 FLANN 失败
【发布时间】:2018-11-18 16:34:35
【问题描述】:

我正在尝试构建 FLANN 库,以便之后构建 PCL 库。

我在使用 CMake 编译源代码时出错。 我想我错过了一些非常基本的东西。由于我无法为我的系统找到已编译的库,我必须自己构建它。

用命令

~/flann-1.8.4-src/build> cmake ..

我明白了

CMake Error at src/cpp/CMakeLists.txt:86 (add_library):
No SOURCES given to target: flann
CMake Error at src/cpp/CMakeLists.txt:32 (add_library):
No SOURCES given to target: flann_cpp

这发生在 SLES11 操作系统上的 flann 1.8.4 和 1.9.1 上。

有什么提示吗?

这里是 cmake 所说内容的完整转录:

-- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found     version "")
CMake Warning at CMakeLists.txt:76 (message):
  hdf5 library not found, some tests will not be run


-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
CMake Warning at CMakeLists.txt:115 (message):
  gtest library not found, some tests will not be run


-- Found OpenMP_C: -fopenmp
-- Found OpenMP_CXX: -fopenmp
-- Found OpenMP: TRUE
CMake Warning at src/matlab/CMakeLists.txt:79 (message):
  Cannot find MATLAB or Octave instalation.  Make sure that the 'bin'
  directory from the MATLAB instalation or that mkoctfile is in PATH


hdf5 library not found, not compiling flann_example.cpp
-- Could NOT find LATEX (missing: LATEX_COMPILER)
-- Install prefix: /usr/local
-- Build type: RelWithDebInfo
-- Building C bindings: ON
-- Building python bindings: ON
-- Building matlab bindings: ON
-- Building CUDA library: OFF
-- Using OpenMP support: ON
-- Using MPI support: OFF
-- Configuring done
CMake Error at src/cpp/CMakeLists.txt:86 (add_library):
  No SOURCES given to target: flann


CMake Error at src/cpp/CMakeLists.txt:32 (add_library):
  No SOURCES given to target: flann_cpp
-- Build files have been written to: ~/flann-1.8.4-src/build

【问题讨论】:

  • 项目的CMakeLists.txt 使用add_library(flann_cpp SHARED "")。他们想构建一个仅包含标头的库,但在 CMake 中构建没有源代码的库并不是正确的方法。顺便说一句,他们已经有一个bug report
  • 谢谢,错误报告给了我正确的解决方法!

标签: cmake flann sles


【解决方案1】:

在你的 flann 目录中 运行

touch src/cpp/empty.cpp

在 src/cpp/CMakeLists.txt 替换

add_library(flann_cpp SHARED "") and add_library(flann SHARED "")

add_library(flann_cpp SHARED empty.cpp) and add_library(flann SHARED empty.cpp)

希望这会有所帮助:) link,感谢 Tsyvarev 的评论

【讨论】:

    猜你喜欢
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 2021-11-27
    • 1970-01-01
    • 2019-10-02
    • 1970-01-01
    相关资源
    最近更新 更多