Cannot build on Ubuntu 18.04 with GCC 7.5.0
Heya, reporting an apparently unsupported build configuration. Noticed this when attempting to update Emscripten to latest at Unity. Our CI gives at CMake time:
[15:06:45.499 Information] Cloning into '/home/bokken/build/output/Unity-Technologies/emscripten-builder/emsdk/binaryen/main'...
[15:06:53.652 Information] Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/googletest'
[15:06:53.656 Information] Cloning into '/home/bokken/build/output/Unity-Technologies/emscripten-builder/emsdk/binaryen/main/third_party/googletest'...
[15:07:00.712 Information] Submodule path 'third_party/googletest': checked out 'e2239ee6043f73722e7aa812a459f54a28552929'
[15:07:00.770 Information] -- The C compiler identification is GNU 7.5.0
[15:07:00.840 Information] -- The CXX compiler identification is GNU 7.5.0
[15:07:00.851 Information] -- Detecting C compiler ABI info
[15:07:00.915 Information] -- Detecting C compiler ABI info - done
[15:07:00.931 Information] -- Check for working C compiler: /usr/bin/cc - skipped
[15:07:00.932 Information] -- Detecting C compile features
-- Detecting C compile features - done
[15:07:00.939 Information] -- Detecting CXX compiler ABI info
[15:07:01.023 Information] -- Detecting CXX compiler ABI info - done
[15:07:01.040 Information] -- Check for working CXX compiler: /usr/bin/c++ - skipped
[15:07:01.041 Information] -- Detecting CXX compile features
[15:07:01.043 Information] -- Detecting CXX compile features - done
[15:07:01.054 Information] fatal: No names found, cannot describe anything.
[15:07:01.055 Information] CMake Warning at CMakeLists.txt:37 (message):
Error running git describe to determine version
[15:07:01.056 Information] -- Building with -DBUILD_LLVM_DWARF
[15:07:01.057 Information] -- Looking for pthread.h
[15:07:01.117 Information] -- Looking for pthread.h - found
[15:07:01.118 Information] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
[15:07:01.183 Information] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
[15:07:01.184 Information] -- Check if compiler accepts -pthread
[15:07:01.254 Information] -- Check if compiler accepts -pthread - yes
[15:07:01.256 Information] -- Found Threads: TRUE
-- Building with -std=c++17
-- Building with -Wall
-- Building with -Werror
-- Building with -Wextra
-- Building with -Wno-unused-parameter
[15:07:01.257 Information] -- Building with -fno-omit-frame-pointer
-- Building with -fno-rtti
-- Building with -Wno-implicit-int-float-conversion
-- Building with -Wno-unknown-warning-option
-- Building with -Wswitch
-- Building with -Wimplicit-fallthrough
-- Building with -Wnon-virtual-dtor
-- Building with -fPIC
-- Building with -O2
-- Building with -UNDEBUG
[15:07:01.508 Information] -- Building libbinaryen as shared library.
[15:07:01.509 Information] -- Configuring done
and then at build time:
for (auto& [Target, _] : Invalidatee->BranchesOut) {
^
[15:07:04.697 Information] /home/bokken/build/output/Unity-Technologies/emscripten-builder/emsdk/binaryen/main/src/cfg/Relooper.cpp: In member function ‘void CFG::Relooper::Calculate(CFG::Block*)::Analyzer::FindIndependentGroups(CFG::BlockSet&, CFG::BlockBlockSetMap&, CFG::BlockSet*)’:
/home/bokken/build/output/Unity-Technologies/emscripten-builder/emsdk/binaryen/main/src/cfg/Relooper.cpp:1319:27: error: unused variable ‘_’ [-Werror=unused-variable]
for (auto& [New, _] : Curr->BranchesOut) {
^
[15:07:04.700 Information] /home/bokken/build/output/Unity-Technologies/emscripten-builder/emsdk/binaryen/main/src/cfg/Relooper.cpp: In member function ‘CFG::Shape* CFG::Relooper::Calculate(CFG::Block*)::Analyzer::Process(CFG::BlockSet&, CFG::BlockSet&)’:
/home/bokken/build/output/Unity-Technologies/emscripten-builder/emsdk/binaryen/main/src/cfg/Relooper.cpp:1549:38: error: unused variable ‘_’ [-Werror=unused-variable]
for (auto& [Target, _] : Curr->BranchesOut) {
^
[15:07:04.997 Information] [ 5%] Building CXX object third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/dwarf2yaml.cpp.o
[15:07:07.253 Information] [ 5%] Building CXX object src/ir/CMakeFiles/ir.dir/eh-utils.cpp.o
[15:07:08.016 Information] [ 5%] Building CXX object third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFAbbreviationDeclaration.cpp.o
[15:07:08.092 Information] At global scope:
cc1plus: error: unrecognized command line option ‘-Wno-unknown-warning-option’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-implicit-int-float-conversion’ [-Werror]
cc1plus: all warnings being treated as errors
[15:07:08.105 Information] src/cfg/CMakeFiles/cfg.dir/build.make:75: recipe for target 'src/cfg/CMakeFiles/cfg.dir/Relooper.cpp.o' failed
[15:07:08.105 Information] make[2]: *** [src/cfg/CMakeFiles/cfg.dir/Relooper.cpp.o] Error 1
[15:07:08.105 Information] CMakeFiles/Makefile2:418: recipe for target 'src/cfg/CMakeFiles/cfg.dir/all' failed
[15:07:08.105 Information] make[1]: *** [src/cfg/CMakeFiles/cfg.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[15:07:08.108 Information] [ 6%] Building CXX object src/ir/CMakeFiles/ir.dir/intrinsics.cpp.o
[15:07:09.305 Information] [ 6%] Building CXX object src/ir/CMakeFiles/ir.dir/lubs.cpp.o
[15:07:09.429 Information] [ 6%] Building CXX object third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFAcceleratorTable.cpp.o
[15:07:10.418 Information] [ 7%] Building CXX object third_party/llvm-project/CMakeFiles/llvm_dwarf.dir/DWARFAddressRange.cpp.o
[15:07:11.168 Information] [ 8%] Building CXX object src/ir/CMakeFiles/ir.dir/memory-utils.cpp.o
Do you know what is the minimum required Ubuntu and/or GCC version and/or Clang/LLVM version to build? Building section only requires a C++17 compiler, which GCC 7.5.0 says it would be.
Hmm, the first one looks like that version of gcc warns more than others for some reason.. To it I think we just need to use the WASM_UNUSED macro on that _ variable to suppress that warning.
The other warning I'm not sure, but maybe there's a gcc flag to not error on unrecognized warning flags?
Another option is for you to disable warnings-as-errors on that build.
This is odd though that you see it happen when updating emscripten, as that code (Relooper) is extremely old... did you change gcc version perhaps?
To my knowledge there should not be any change in the CI config.. I am using the identical VM image to build as before. I observed this change when updating the CI from Emscripten 2.0.19 to building 3.1.8.
Passing -DENABLE_WERROR=0 to Binaryen CMake does get through the warnings and I got a green CI run.