3

I'm trying to use this repo :

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

These are the packages that I have installed :

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

unfortunately I get an error at the end and I don't know how to fix.

-- 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
john_connor
  • 165
  • 2
  • 2
  • 15
  • Looks like `Werror` is turned on. That causes builds to fail on warnings. [Here](https://stackoverflow.com/questions/41182827/disable-werror-for-one-of-cmakelists-txt) is a SO answer on this. – Jason Mar 10 '20 at 01:28
  • Reading the instructions that you gave me I haven't been able to fix the problem. I tried to do : export CFLAGS="-Wno-error" and export CXXFLAGS="-Wno-error" ; but it didn't work. – john_connor Mar 10 '20 at 09:05

1 Answers1

0

Started typing up a response to this in comments but it got too long... So I'll just make is an answer.

What you have are clearly 2 warnings, yet you are failing with 2 errors. That is what -Werror does. Now, what you did with -Wno-error should work, but it can be overwritten if followed by -Werror. For example, if I build a simple program with gcc like this:

gcc -Wno-error -Werror test.c

The -Werror command has overwritten the -Wno-error command. I just looked at the CMakeLists.txt file from that project, and I don't see any mention to -Werror. Since that is off by default, it must be in there somewhere. Here is a snippet from the CMakeLists.txt file from that project:

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}")

I am thinking that -Werror may be set for the ${OpenMP_C_FLAGS} or ${OpenMP_CXX_Flags}. To test this, you can use cmake's message function. Add the following lines after the CMAKE_CXX_FLAGS assignment:

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

My theory is that you will find a -Werror in there somewhere. If that is the case, just throw -Wno-error on the end of these two lines (8 and 10) in CMakeLists.txt:

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

The trailling -Wno-error will overwrite any -Werror in there. There may be a more pure cmake solution to handling this, but I'm not a cmake expert.

Jason
  • 2,493
  • 2
  • 27
  • 27
  • I was getting the same error and I tried your solution. It is still not working for me and I get the same problem. Also, I couldn't find any mention of Werror anywhere in the folder. – Anirudh Thatipelli Apr 09 '20 at 17:12