Repository: WebAssembly/wabt

Issue #1703: 1.0.24 compilation error with gcc-4.8.5 (RHEL/CentOS 7)
Created: 2021-08-20T12:16:51Z
wabt 1.0.24 fails to compile with system compiler (gcc-4.8.5) on RHEL/CentOS 7:
[ 83%] Building CXX object CMakeFiles/wasm.dir/src/interp/interp-wasm-c-api.cc.o
/usr/bin/c++  -DWASM_API_EXTERN="__attribute__((visibility(\"default\")))" -D__STDC_FORMAT_MACROS=1 -D__STDC_LIMIT_MACROS=1 -Dwasm_EXPORTS -I/builddir/build/BUILD/wabt-1.0.24 -I/builddir/build/BUILD/wabt-1.0.24/x86_64-redhat-linux-gnu -I/builddir/build/BUILD/wabt-1.0.24/third_party/wasm-c-api/include -I/builddir/build/BUILD/wabt-1.0.24/third_party/gtest/googletest -I/builddir/build/BUILD/wabt-1.0.24/third_party/gtest/googletest/include  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -std=c++11 -Wold-style-cast -fno-exceptions -fPIC -fvisibility=hidden   -Wall -Wextra -Wno-unused-parameter -Wpointer-arith -Wuninitialized -Wno-clobbered -Wno-old-style-cast -o CMakeFiles/wasm.dir/src/interp/interp-wasm-c-api.cc.o -c /builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc: In constructor 'wasm_globaltype_t::wasm_globaltype_t(wasm_valtype_t*, wasm_mutability_t)':
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:129:22: error: could not convert '* type' from 'wasm_valtype_t' to 'wabt::interp::ValueType {aka wabt::Type}'
         valtype{*type} {
                      ^
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc: In constructor 'wasm_tabletype_t::wasm_tabletype_t(wabt::interp::TableType)':
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:152:41: error: cannot convert 'wasm_limits_t' to 'uint32_t {aka unsigned int}' in initialization
         limits{FromWabtLimits(tt.limits)} {}
                                         ^
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:152:41: warning: missing initializer for member 'wasm_limits_t::max' [-Wmissing-field-initializers]
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc: In constructor 'wasm_memorytype_t::wasm_memorytype_t(const wasm_limits_t*)':
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:162:23: error: cannot convert 'const wasm_limits_t' to 'uint32_t {aka unsigned int}' in initialization
         limits{*limits} {}
                       ^
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:162:23: warning: missing initializer for member 'wasm_limits_t::max' [-Wmissing-field-initializers]
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc: In constructor 'wasm_memorytype_t::wasm_memorytype_t(wabt::interp::MemoryType)':
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:166:41: error: cannot convert 'wasm_limits_t' to 'uint32_t {aka unsigned int}' in initialization
         limits{FromWabtLimits(mt.limits)} {}
                                         ^
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:166:41: warning: missing initializer for member 'wasm_limits_t::max' [-Wmissing-field-initializers]
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc: In function 'wasm_frame_t* wasm_frame_copy(const wasm_frame_t*)':
/builddir/build/BUILD/wabt-1.0.24/src/interp/interp-wasm-c-api.cc:1024:33: error: could not convert '* frame' from 'const wasm_frame_t' to 'wabt::interp::Frame'
   return new wasm_frame_t{*frame};
                                 ^
gmake[2]: *** [CMakeFiles/wasm.dir/src/interp/interp-wasm-c-api.cc.o] Error 1

For now, I've worked around this by using a newer gcc version from optional DevToolset repository, but I wonder if this could be fixed easily to preserve compatiblity with this old compiler. The C++11 support there is quite complete.

Duplicate issue #1773: Build failed on CentOS 7
Created: 2021-12-05T10:29:01Z
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc: In constructor ‘wasm_globaltype_t::wasm_globaltype_t(wasm_valtype_t*, wasm_mutability_t)’:
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:129:22: error: could not convert ‘* type’ from ‘wasm_valtype_t’ to ‘wabt::interp::ValueType {aka wabt::Type}’
valtype{type} {
^
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc: In constructor ‘wasm_tabletype_t::wasm_tabletype_t(wabt::interp::TableType)’:
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:152:41: error: cannot convert ‘wasm_limits_t’ to ‘uint32_t {aka unsigned int}’ in initialization
limits{FromWabtLimits(tt.limits)} {}
^
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:152:41: warning: missing initializer for member ‘wasm_limits_t::max’ [-Wmissing-field-initializers]
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc: In constructor ‘wasm_memorytype_t::wasm_memorytype_t(const wasm_limits_t)’:
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:162:23: error: cannot convert ‘const wasm_limits_t’ to ‘uint32_t {aka unsigned int}’ in initialization
limits{limits} {}
^
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:162:23: warning: missing initializer for member ‘wasm_limits_t::max’ [-Wmissing-field-initializers]
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc: In constructor ‘wasm_memorytype_t::wasm_memorytype_t(wabt::interp::MemoryType)’:
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:166:41: error: cannot convert ‘wasm_limits_t’ to ‘uint32_t {aka unsigned int}’ in initialization
limits{FromWabtLimits(mt.limits)} {}
^
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:166:41: warning: missing initializer for member ‘wasm_limits_t::max’ [-Wmissing-field-initializers]
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc: In function ‘wasm_frame_t wasm_frame_copy(const wasm_frame_t*)’:
/root/wasm/wabt/src/interp/interp-wasm-c-api.cc:1024:33: error: could not convert ‘* frame’ from ‘const wasm_frame_t’ to ‘wabt::interp::Frame’
return new wasm_frame_t{*frame};
^
gmake[2]: *** [CMakeFiles/wasm.dir/src/interp/interp-wasm-c-api.cc.o] Error 1
gmake[1]: *** [CMakeFiles/wasm.dir/all] Error 2
gmake: *** [all] Error 2

Closing comment (2022-02-07T22:00:46Z): This is a duplicate of #1703 . Use a newer gcc from devtoolset.