Build Error using Windows and mingw32-make
bretwitt opened this issue · 1 comments
Hello, I'm on Windows 10 using Cmake & mingw32-make to build Octomap. I was following the build instructions to the tee, but I ran into this error. not sure what could be going wrong. Looks like something to do with mingw if I had to guess though.
`PS C:\Users\legon\Desktop\octomap\octomap\build> mingw32-make.exe
[ 4%] Built target octomath
[ 9%] Built target octomath-static
Consolidate compiler generated dependencies of target octomap
[ 10%] Building CXX object octomap/src/CMakeFiles/octomap.dir/AbstractOccupancyOcTree.cpp.obj
In file included from C:/Users/legon/Desktop/octomap/octomap/include/octomap/OcTreeNode.h:37:0,
from C:/Users/legon/Desktop/octomap/octomap/include/octomap/AbstractOccupancyOcTree.h:39,
from C:\Users\legon\Desktop\octomap\octomap\src\AbstractOccupancyOcTree.cpp:35:
C:\Users\legon\Desktop\octomap\octomap\src\AbstractOccupancyOcTree.cpp: In member function 'bool octomap::AbstractOccupancyOcTree::readBinary(std::istream&)':
C:/Users/legon/Desktop/octomap/octomap/include/octomap/octomap_types.h:78:92: error: unknown conversion type character 'z' in format [-Werror=format=]
#define OCTOMAP_ERROR(...) fprintf(stderr, "ERROR: "), fprintf(stderr, VA_ARGS), fflush(stderr)
^
C:\Users\legon\Desktop\octomap\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);
^~~~~~~~~~~~~
C:/Users/legon/Desktop/octomap/octomap/include/octomap/octomap_types.h:78:92: error: too many arguments for format [-Werror=format-extra-args]
#define OCTOMAP_ERROR(...) fprintf(stderr, "ERROR: "), fprintf(stderr, VA_ARGS), fflush(stderr)
^
C:\Users\legon\Desktop\octomap\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);
^~~~~~~~~~~~~
cc1plus.exe: all warnings being treated as errors
octomap\src\CMakeFiles\octomap.dir\build.make:90: recipe for target 'octomap/src/CMakeFiles/octomap.dir/AbstractOccupancyOcTree.cpp.obj' failed
mingw32-make[2]: *** [octomap/src/CMakeFiles/octomap.dir/AbstractOccupancyOcTree.cpp.obj] Error 1
CMakeFiles\Makefile2:1128: recipe for target 'octomap/src/CMakeFiles/octomap.dir/all' failed
mingw32-make[1]: *** [octomap/src/CMakeFiles/octomap.dir/all] Error 2
Makefile:164: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
PS C:\Users\legon\Desktop\octomap\octomap\build>
`
There are some reasons and possible solutions mentioned here: https://stackoverflow.com/questions/59779751/why-will-mingw-w64-gcc-compiler-generate-wrong-warning-about-the-format-of-zd-a
It could also help to disable the "Warnings as Errors" option (-Werror
flag in CompilerSettings.cmake)