cmake tensorflow lite的add_subdirectory在后续运行中失败



我正试图根据这里的最小示例在项目中包含tensorflow lite:使用CMake构建tensorflow lite。具体来说,我正在尝试按照建议为tflite添加CMakeLists.txt的_subdirectory。

当项目第一次构建时,这是有效的,但如果我出于任何原因更改了我的顶级CMakeLists.txt(例如,添加测试或将某些内容链接到不同的目标(,那么构建将失败,并出现以下情况:

-- Setting build type to Release, for debug builds use'-DCMAKE_BUILD_TYPE=Debug'.
CMake Warning at build/abseil-cpp/CMakeLists.txt:70 (message):
A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake
3.8 and up.  We recommend enabling this option to ensure your project still
builds correctly.

-- Standard libraries to link to explicitly: none
-- The Fortran compiler identification is GNU 9.4.0
-- Could NOT find CLANG_FORMAT: Found unsuitable version "0.0", but required is exact version "9" (found CLANG_FORMAT_EXECUTABLE-NOTFOUND)
-- 
-- Configured Eigen 3.4.90
-- 
-- Proceeding with version: 2.0.6.v2.0.6
-- CMAKE_CXX_FLAGS:  -std=c++0x -Wall -pedantic -Werror -Wextra -Werror=shadow -faligned-new -Werror=implicit-fallthrough=2 -Wunused-result -Werror=unused-result -Wunused-parameter -Werror=unused-parameter -fsigned-char
CMake Error at build/cpuinfo/CMakeLists.txt:262 (ADD_SUBDIRECTORY):
ADD_SUBDIRECTORY not given a binary directory but the given source
directory "/opt/------/workspace/------/build/clog-source"
is not a subdirectory of
"/opt/------/workspace/------/build/cpuinfo".  When
specifying an out-of-tree source a binary directory must be explicitly
specified.

CMake Error at build/cpuinfo/CMakeLists.txt:265 (SET_PROPERTY):
SET_PROPERTY could not find TARGET clog.  Perhaps it has not yet been
created.

-- Configuring incomplete, errors occurred!
See also "/opt/------/workspace/------/build/CMakeFiles/CMakeOutput.log".
See also "/opt/------/workspace/------/build/CMakeFiles/CMakeError.log".

(这些破折号不是真正的路径,它们只是为了掩盖敏感信息。(

只是重申一下,它确实在第一次正确配置和构建,但cmake ..的重新运行将失败。

我在几个平台上尝试过,得到了同样的结果。您应该能够使用包含add_subdirectory和一些helloworld目标的最小CMakeLists.txt来复制tensorflow lite。

我试着给阻塞的add_subdirectory一个二进制位置,但只得到了一连串的新错误,在这一点上,我的CMake技术肯定用完了。

问题是由于xnnpackcpuinfo中使用的cmake变量CLOG_SOURCE_DIR相同。

xnnpack中,它使用cmake脚本来下载、配置和构建阻塞。在cpuinfo中,它作为子目录添加。因此,他们使用不同的方式来添加依赖关系。我们需要在xnnpackcpuinfo中解决这个问题,但作为演练,我们可以将任一项目中的CLOG_SOURCE_DIR更改为不同的名称(例如CLOG_SOURCE_DIR1(,然后这个问题就会消失。

相关内容

  • 没有找到相关文章

最新更新