binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

Error when installing

Open Nullifyrr opened this issue 5 months ago • 3 comments

when installing using cmake on arch linux, i get this error `[sypherrd@inferno binaryen]$ cmake . && make -- No build type selected, default to Release -- Building with -fno-omit-frame-pointer -- Building with -fno-rtti -- Building with -fPIC -- Building with -UNDEBUG -- Building with -DBUILD_LLVM_DWARF -- Building with -Wall -- Building with -Werror -- Building with -Wextra -- Building with -Wno-unused-parameter -- Building with -Wno-dangling-pointer -- 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 libbinaryen as shared library. -- Linking with -Bsymbolic -- Configuring done (0.1s) -- Generating done (0.0s) -- Build files have been written to: /home/sypherrd/binaryen [ 18%] Built target llvm_dwarf [ 19%] Building CXX object CMakeFiles/binaryen.dir/src/passes/Strip.cpp.o In file included from /usr/include/c++/15.2.1/functional:61, from /home/sypherrd/binaryen/src/passes/Strip.cpp:22: In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = bool; _ArgTypes = {wasm::CustomSection&}]’, inlined from ‘wasm::Strip::Strip(Decider)’ at /home/sypherrd/binaryen/src/passes/Strip.cpp:37:28, inlined from ‘wasm::Pass* wasm::createStripDebugPass()’ at /home/sypherrd/binaryen/src/passes/Strip.cpp:62:4: /usr/include/c++/15.2.1/bits/std_function.h:393:17: error: ‘’ may be used uninitialized [-Werror=maybe-uninitialized] 393 | __x._M_manager(_M_functor, __x._M_functor, __clone_functor); | ~~~~^~~~~~~~~~ /usr/include/c++/15.2.1/bits/std_function.h: In function ‘wasm::Pass* wasm::createStripDebugPass()’: /usr/include/c++/15.2.1/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = bool; _Functor = wasm::createStripDebugPass()::<lambda(const wasm::CustomSection&)>; _ArgTypes = {wasm::CustomSection&}]’ declared here 269 | _M_manager(_Any_data& __dest, const _Any_data& __source, | ^~~~~~~~~~ /home/sypherrd/binaryen/src/passes/Strip.cpp:58:20: note: ‘’ declared here 58 | return new Strip([&](const CustomSection& curr) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 59 | return curr.name == BinaryConsts::CustomSections::Name || | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 | curr.name == BinaryConsts::CustomSections::SourceMapUrl || | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 61 | curr.name.find(".debug") == 0 || curr.name.find("reloc..debug") == 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 62 | }); | ~
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = bool; _ArgTypes = {wasm::CustomSection&}]’, inlined from ‘wasm::Strip::Strip(Decider)’ at /home/sypherrd/binaryen/src/passes/Strip.cpp:37:28, inlined from ‘wasm::Pass* wasm::createStripDWARFPass()’ at /home/sypherrd/binaryen/src/passes/Strip.cpp:68:4: /usr/include/c++/15.2.1/bits/std_function.h:393:17: error: ‘’ may be used uninitialized [-Werror=maybe-uninitialized] 393 | __x._M_manager(_M_functor, __x._M_functor, __clone_functor); | ~~~~^~~~~~~~~~ /usr/include/c++/15.2.1/bits/std_function.h: In function ‘wasm::Pass* wasm::createStripDWARFPass()’: /usr/include/c++/15.2.1/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = bool; _Functor = wasm::createStripDWARFPass()::<lambda(const wasm::CustomSection&)>; _ArgTypes = {wasm::CustomSection&}]’ declared here 269 | _M_manager(_Any_data& __dest, const _Any_data& __source, | ^~~~~~~~~~ /home/sypherrd/binaryen/src/passes/Strip.cpp:66:20: note: ‘’ declared here 66 | return new Strip([&](const CustomSection& curr) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 67 | return curr.name.find(".debug") == 0 || curr.name.find("reloc..debug") == 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | }); | ~
In copy constructor ‘std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = bool; _ArgTypes = {wasm::CustomSection&}]’, inlined from ‘wasm::Strip::Strip(Decider)’ at /home/sypherrd/binaryen/src/passes/Strip.cpp:37:28, inlined from ‘wasm::Pass* wasm::createStripProducersPass()’ at /home/sypherrd/binaryen/src/passes/Strip.cpp:74:4: /usr/include/c++/15.2.1/bits/std_function.h:393:17: error: ‘’ may be used uninitialized [-Werror=maybe-uninitialized] 393 | __x._M_manager(_M_functor, __x._M_functor, __clone_functor); | ~~~~^~~~~~~~~~ /usr/include/c++/15.2.1/bits/std_function.h: In function ‘wasm::Pass* wasm::createStripProducersPass()’: /usr/include/c++/15.2.1/bits/std_function.h:269:7: note: by argument 2 of type ‘const std::_Any_data&’ to ‘static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_manager(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = bool; _Functor = wasm::createStripProducersPass()::<lambda(const wasm::CustomSection&)>; _ArgTypes = {wasm::CustomSection&}]’ declared here 269 | _M_manager(_Any_data& __dest, const _Any_data& __source, | ^~~~~~~~~~ /home/sypherrd/binaryen/src/passes/Strip.cpp:72:20: note: ‘’ declared here 72 | return new Strip([&](const CustomSection& curr) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | return curr.name == BinaryConsts::CustomSections::Producers; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | }); | ~
At global scope: cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option ‘-Wno-implicit-int-float-conversion’ may have been intended to silence earlier diagnostics cc1plus: all warnings being treated as errors make[2]: *** [CMakeFiles/binaryen.dir/build.make:1745: CMakeFiles/binaryen.dir/src/passes/Strip.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:508: CMakeFiles/binaryen.dir/all] Error 2 make: *** [Makefile:136: all] Error 2 [sypherrd@inferno binaryen]$

`

any help would be appreciated, thanks!

Nullifyrr avatar Sep 19 '25 04:09 Nullifyrr

We have a few places already where we need to disable that gcc warning, and I guess we might need another place here.

Here is an example:

https://github.com/WebAssembly/binaryen/blob/07e02d283ebe7b1a68f11d4b6030665e33ebbb32/src/ir/metadata.cpp#L80

A PR would be welcome as a workaround.

kripken avatar Sep 19 '25 16:09 kripken

(meanwhile, you can disable warnings-as-errors and/or use an older gcc, to avoid this locally)

kripken avatar Sep 19 '25 16:09 kripken

In case someone else finds this thread while dealing with the error above, here is how to disable "warnings-as-errors": in the cmake invocation, pass the arg -DENABLE_WERROR=OFF.

demurgos avatar Dec 08 '25 23:12 demurgos