Open SpaceIm opened 3 years ago
Ok, I see that -Wno-error
has been replaced by -Werror
: https://github.com/OctoMap/octomap/commit/85bbd66360290461a9a80927761bf197f6511f6a#diff-c2c2bf6142b175565390edaed1190aa0f8cf0f167ed78106a2f12996420357bc
While it's recommended for developers, it would be nice to allow to disable those developer compilation flags for package managers (through an option). It can break with any new compiler version.
While it's recommended for developers, it would be nice to allow to disable those developer compilation flags for package managers (through an option). It can break with any new compiler version.
Good point, this was introduced in https://github.com/OctoMap/octomap/pull/312
Are there best practices for an option through CMake? Otherwise I tend to revert the corresponding change.
I guess you can add an option like OCTOMAP_DEVELOPER_FLAGS
, it's fine. Then depending on its value, Werror is injected or not.
It would also be great to allow us to choose our compiler. I came across this issue because my compiler is using c++98
by default, but I could compile with -Werror
by changing the compiler to c++11
(i.e., add the following to /octomap/CMakeLists.txt
):
add_compile_options(-std=c++11)
It doesn't solve both my problem and Spacelm's problem, as it seems that Spacelm needs to compile with gcc 6.
It would also be great to allow us to choose our compiler. I came across this issue because my compiler is using c++98 by default, but I could compile with -Werror by changing the compiler to c++11
Just to be sure, you probably mean compiler options / standard, and not the actual compiler, don't you?
You can use the standard CMake options for that but will have to disable the octovis Qt5 option, because that one will set the C++ Version to C++11 E.g.
cmake .. -DCMAKE_CXX_STANDARD=20 -DOCTOVIS_QT5=Off
or cmake .. -DCMAKE_CXX_STANDARD=11
should both work.
@SpaceIm: Did I understand you correctly that removing -Werror
fixes this issue for you?
I tried to add 1.9.6 in conan public remote (which already has 1.9.3 and 1.9.5), but compilation of octomap fails with gcc < 6
https://github.com/conan-io/conan-center-index/pull/4370#issuecomment-767710961
Click to expand log
``` ----Running------ > cd '/home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="4.9" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/package/a506942c4fdc4003ced5ed2afee2a0486db24337" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DOCTOMAP_OMP="False" -DBUILD_TESTING="False" -Wno-dev '/home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337' ----------------- -- The C compiler identification is GNU 4.9.4 -- The CXX compiler identification is GNU 4.9.4 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Conan: called by CMake conan helper -- Conan: called inside local cache -- Conan: Adjusting output directories -- Conan: Using cmake global configuration -- Conan: Adjusting default RPATHs Conan policies -- Conan: Adjusting language standard -- Conan: Adjusting fPIC flag (ON) -- Conan: Checking correct version: 4.9 -- Conan: C++ stdlib: libstdc++ -- octomap building as Release -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Compile octomap using: make -- Install octomap using: make install -- (be sure to set the correct CMAKE_INSTALL_PREFIX before) -- Compile API-documentation using: make docs -- Configuring done -- Generating done -- Build files have been written to: /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337 ----Running------ > cmake --build '/home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337' '--' '-j3' ----------------- Scanning dependencies of target octomath-static [ 7%] Building CXX object source_subfolder/octomap/src/math/CMakeFiles/octomath-static.dir/Vector3.cpp.o [ 14%] Building CXX object source_subfolder/octomap/src/math/CMakeFiles/octomath-static.dir/Quaternion.cpp.o [ 21%] Building CXX object source_subfolder/octomap/src/math/CMakeFiles/octomath-static.dir/Pose6D.cpp.o [ 28%] Linking CXX static library ../../../../lib/liboctomath.a [ 28%] Built target octomath-static Scanning dependencies of target octomap-static [ 35%] Building CXX object source_subfolder/octomap/src/CMakeFiles/octomap-static.dir/AbstractOcTree.cpp.o [ 50%] Building CXX object source_subfolder/octomap/src/CMakeFiles/octomap-static.dir/AbstractOccupancyOcTree.cpp.o [ 50%] Building CXX object source_subfolder/octomap/src/CMakeFiles/octomap-static.dir/Pointcloud.cpp.o In file included from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTreeNode.h:37:0, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/AbstractOccupancyOcTree.h:39, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/AbstractOccupancyOcTree.cpp:35: /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:69:27: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_DEBUG(...) (void)0 ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:70:31: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_DEBUG_STR(...) (void)0 ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:76:27: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_WARNING(...) fprintf(stderr, "WARNING: "), fprintf(stderr, __VA_ARGS__), fflush(stderr) ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:78:25: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_ERROR(...) fprintf(stderr, "ERROR: "), fprintf(stderr, __VA_ARGS__), fflush(stderr) ^ In file included from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OccupancyOcTreeBase.h:42:0, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTree.h:38, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/AbstractOcTree.cpp:36: /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:69:27: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_DEBUG(...) (void)0 ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:70:31: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_DEBUG_STR(...) (void)0 ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:76:27: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_WARNING(...) fprintf(stderr, "WARNING: "), fprintf(stderr, __VA_ARGS__), fflush(stderr) ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:78:25: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_ERROR(...) fprintf(stderr, "ERROR: "), fprintf(stderr, __VA_ARGS__), fflush(stderr) ^ In file included from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/Pointcloud.h:39:0, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/Pointcloud.cpp:52: /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:69:27: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_DEBUG(...) (void)0 ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:70:31: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_DEBUG_STR(...) (void)0 ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:76:27: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_WARNING(...) fprintf(stderr, "WARNING: "), fprintf(stderr, __VA_ARGS__), fflush(stderr) ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:78:25: error: anonymous variadic macros were introduced in C99 [-Werror=variadic-macros] #define OCTOMAP_ERROR(...) fprintf(stderr, "ERROR: "), fprintf(stderr, __VA_ARGS__), fflush(stderr) ^ In file included from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTreeNode.h:37:0, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/AbstractOccupancyOcTree.h:39, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/AbstractOccupancyOcTree.cpp:35: /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/AbstractOccupancyOcTree.cpp: In member function 'bool octomap::AbstractOccupancyOcTree::readBinary(std::istream&)': /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/octomap_types.h:78:92: error: ISO C++98 does not support the 'z' gnu_printf length modifier [-Werror=format=] #define OCTOMAP_ERROR(...) fprintf(stderr, "ERROR: "), fprintf(stderr, __VA_ARGS__), fflush(stderr) ^ /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/AbstractOccupancyOcTree.cpp:173:7: note: in expansion of macro 'OCTOMAP_ERROR' OCTOMAP_ERROR("Tree size mismatch: # read nodes (%zu) != # expected nodes (%d)\n",this->size(), size); ^ In file included from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OccupancyOcTreeBase.h:44:0, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTree.h:38, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/AbstractOcTree.cpp:36: /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTreeBaseImpl.h:251:19: error: ISO C++ 1998 does not support 'long long' [-Werror=long-long] unsigned long long memoryFullGrid() const; ^ cc1plus: all warnings being treated as errors make[2]: *** [source_subfolder/octomap/src/CMakeFiles/octomap-static.dir/AbstractOccupancyOcTree.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... In file included from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTreeBaseImpl.h:573:0, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OccupancyOcTreeBase.h:44, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTree.h:38, from /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/src/AbstractOcTree.cpp:36: /home/conan/w/cci_PR-4370/.conan/data/octomap/1.9.6/_/_/build/a506942c4fdc4003ced5ed2afee2a0486db24337/source_subfolder/octomap/include/octomap/OcTreeBaseImpl.hxx: In member function 'std::istream& octomap::OcTreeBaseImpl