【问题标题】:Monocular Total Capture compilation process error : Makefile:83: recipe for target 'CMakeFiles/mylib.dir/all' failed单目总捕获编译过程错误:Makefile:83: recipe for target 'CMakeFiles/mylib.dir/all' failed
【发布时间】:2020-03-10 00:04:15
【问题描述】:

我正在尝试使用这个仓库:

https://github.com/CMU-Perceptual-Computing-Lab/MonocularTotalCapture

这些是我安装的软件包:

ffmpeg
Python 2.7.12 (with TensorFlow 1.5.0, OpenCV, Matplotlib, packages installed with pip3)
openCV 4.2.0
cmake = 3.5.1
OpenCV 2.4.13 (compiled from source with CUDA 9.0, CUDNN 7.0)
Ceres-Solver 1.13.0 (with SuiteSparse)
OpenGL, GLUT, GLEW
libigl https://github.com/libigl/libigl
wget
OpenPose
eigen3, version 3.3.7
Boost version: 1.58.0
GNU 5.4.0

很遗憾,最后我得到了一个错误,我不知道如何解决。

-- Build files have been written to: /home/ziom/Scrivania/MonocularTotalCapture/FitAdam/build

mario@ziom-Z87-HD3:/home/ziom/Scrivania/MonocularTotalCapture/FitAdam/build# make -j12

/home/ziom/Scrivania/MonocularTotalCapture/FitAdam/src/AdamFastCost.cpp: In member function ‘void AdamFullCost::SparseRegress(const Eigen::SparseMatrix<double, 0>&, const double*, const double*, const double*, const double*, double*, double*, double*, double*) const’:
/home/ziom/Scrivania/MonocularTotalCapture/FitAdam/src/AdamFastCost.cpp:1200:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int ic = 0; ic < total_vertex.size(); ic++)
^
/home/ziom/Scrivania/MonocularTotalCapture/FitAdam/src/AdamFastCost.cpp:1225:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int ic = 0; ic < total_vertex.size(); ic++)
^
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mylib.dir/all' failed
make[1]: *** [CMakeFiles/MYLIB.dir/all] Errore 2
Makefile:83: recipe for target 'CMakeFiles/mylib.dir/all' failed
make: *** [all] Errore 2

【问题讨论】:

  • 看起来Werror 已打开。这会导致构建在警告时失败。 Here 是对此的一个答案。
  • 阅读您给我的说明我无法解决问题。我试着做: export CFLAGS="-Wno-error" 和 export CXXFLAGS="-Wno-error" ;但它没有用。

标签: c++ cmake compiler-errors


【解决方案1】:

开始在 cmets 中输入对此的回复,但它太长了......所以我将只是一个答案。

您所拥有的显然是 2 个警告,但您却因 2 个错误而失败。这就是-Werror 所做的。现在,你对-Wno-error 所做的应该可以工作,但如果后面跟着-Werror,它可能会被覆盖。例如,如果我像这样使用 gcc 构建一个简单的程序:

gcc -Wno-error -Werror test.c

-Werror 命令已覆盖-Wno-error 命令。我只是查看了该项目中的 CMakeLists.txt 文件,但没有看到任何提及 -Werror。由于默认情况下它是关闭的,它必须在某个地方。这是来自该项目的 CMakeLists.txt 文件的 sn-p:

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")

我认为-Werror 可以设置为${OpenMP_C_FLAGS}${OpenMP_CXX_Flags}。要对此进行测试,您可以使用 cmake 的 message 函数。在CMAKE_CXX_FLAGS 赋值后添加以下行:

message("CFlags: ${CMAKE_C_FLAGS} CXXFlags: ${CMAKE_CXX_FLAGS}")

我的理论是你会在某处找到-Werror。如果是这种情况,只需在 CMakeLists.txt 中这两行(8 和 10)的末尾抛出 -Wno-error

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -Wno-error")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -Wno-error")

尾随的-Wno-error 将覆盖其中的任何-Werror。可能有更纯粹的 cmake 解决方案来处理这个问题,但我不是 cmake 专家。

【讨论】:

  • 我遇到了同样的错误,我尝试了你的解决方案。它仍然对我不起作用,我遇到了同样的问题。此外,我在文件夹中的任何地方都找不到任何提及 Werror 的内容。
猜你喜欢
  • 2020-11-15
  • 2022-07-02
  • 2017-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-04
相关资源
最近更新 更多