hera icon indicating copy to clipboard operation
hera copied to clipboard

[WIP] Update Binaryen to 1.38.24

Open axic opened this issue 7 years ago • 21 comments

Depends on https://github.com/ethereum/aleth/pull/5343.

axic avatar Jul 30 '18 12:07 axic

Bummer, this needs python in the build env:

[10/106] Generating WasmIntrinsics.cpp
FAILED: src/passes/WasmIntrinsics.cpp 
cd /home/builder/build/deps/src/binaryen-build/src/passes && python /home/builder/build/deps/src/binaryen/scripts/embedwast.py /home/builder/build/deps/src/binaryen/src/passes/wasm-intrinsics.wast /home/builder/build/deps/src/binaryen-build/src/passes/WasmIntrinsics.cpp
/bin/sh: 1: python: not found

axic avatar Jul 30 '18 12:07 axic

The cpp-build-env has Python 3 installed. Try symlinking it to python.

chfast avatar Jul 30 '18 14:07 chfast

Why do you update it anyway?

chfast avatar Jul 30 '18 14:07 chfast

Our immediate benefit is the arguments to callExport are const so we can simplify that code, however two actual reasons:

  • wanted to pull in fixes from the last 3 months
  • wanted to use the same version of evm2wasm and hera

axic avatar Jul 30 '18 14:07 axic

After supplying python, this still has some weird build issue:

100%] Linking CXX executable bin/wasm-emscripten-finalize
CMakeFiles/wasm-emscripten-finalize.dir/src/tools/wasm-emscripten-finalize.cpp.o: In function `main':
wasm-emscripten-finalize.cpp:(.text+0x111b): undefined reference to `wasm::ModuleReader::read(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, wasm::Module&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/wasm-emscripten-finalize.dir/build.make:100: recipe for target 'bin/wasm-emscripten-finalize' failed
make[5]: *** [bin/wasm-emscripten-finalize] Error 1

axic avatar Aug 10 '18 09:08 axic

binaryen is probably not built with C++11 and std::string ABI does not match. Using toolchain file as in #293 might help.

chfast avatar Aug 10 '18 09:08 chfast

Rebased on top the toolchain file, but still failing.

axic avatar Aug 10 '18 11:08 axic

Maybe it conflicts with the binaryen in Aleth.

chfast avatar Aug 13 '18 11:08 chfast

This builds statically and shared, except shared with coverage for some reason:

[23/23] Linking CXX shared library src/libhera.so
FAILED: src/libhera.so 
: && /usr/bin/g++  -fPIC -g  --coverage   -Wl,--no-undefined -shared -Wl,-soname,libhera.so -o src/libhera.so src/CMakeFiles/hera.dir/binaryen.cpp.o src/CMakeFiles/hera.dir/eei.cpp.o src/CMakeFiles/hera.dir/hera.cpp.o  hera/libbuildinfo.a evmc/lib/instructions/libevmc-instructions.a evm2wasm/libs/evm2wasm/libevm2wasm.a deps/lib/libbinaryen.a deps/src/binaryen-build/lib/libwasm.a deps/src/binaryen-build/lib/libasmjs.a deps/src/binaryen-build/lib/libpasses.a deps/src/binaryen-build/lib/libcfg.a deps/src/binaryen-build/lib/libir.a deps/src/binaryen-build/lib/libemscripten-optimizer.a deps/src/binaryen-build/lib/libsupport.a -lpthread /home/builder/.hunter/_Base/5ead1e0/0fe0970/ead1bc1/Install/lib/libfmt.a && :
src/CMakeFiles/hera.dir/hera.cpp.o: In function `(anonymous namespace)::mktemp_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/builder/project/src/hera.cpp:155: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
deps/src/binaryen-build/lib/libpasses.a(pass.cpp.o): In function `wasm::dumpWast(wasm::Name, wasm::Module*)':
pass.cpp:(.text+0x9f1): undefined reference to `wasm::ModuleWriter::write(wasm::Module&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
deps/src/binaryen-build/lib/libpasses.a(FuncCastEmulation.cpp.o): In function `wasm::FuncCastEmulation::run(wasm::PassRunner*, wasm::Module*)':
FuncCastEmulation.cpp:(.text._ZN4wasm17FuncCastEmulation3runEPNS_10PassRunnerEPNS_6ModuleE[_ZN4wasm17FuncCastEmulation3runEPNS_10PassRunnerEPNS_6ModuleE]+0x16e): undefined reference to `wasm::EmscriptenGlueGenerator::generateDynCallThunks()'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Exited with code 1

axic avatar Aug 27 '18 13:08 axic

Maybe wait for: https://github.com/WebAssembly/binaryen/pull/1672.

chfast avatar Sep 07 '18 16:09 chfast

This produces a crash on macos:

Executing message in Hera
Received 'segmentation fault' signal

axic avatar Dec 13 '18 21:12 axic

Codecov Report

Merging #275 into master will decrease coverage by 1.56%. The diff coverage is 38.09%.

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
- Coverage   71.04%   69.47%   -1.57%     
==========================================
  Files           9        7       -2     
  Lines        1554      973     -581     
  Branches      137      129       -8     
==========================================
- Hits         1104      676     -428     
+ Misses        422      270     -152     
+ Partials       28       27       -1

codecov-io avatar Jan 21 '19 12:01 codecov-io

Git history cleaned up.

chfast avatar Jan 21 '19 13:01 chfast

I think Binaryen: Skip redundant wasm:: namespace should be squashed into Simplify callExport() since the arguments parameter is const now as its commit log doesn't make sense anymore.

axic avatar Jan 22 '19 02:01 axic

@axic it crashes on macos so you have to check it yourself.

chfast avatar Jan 22 '19 11:01 chfast

Assertion failed: (*currp), function pushTask, file /Users/distiller/build/deps/src/binaryen/src/wasm-traversal.h, line 372.
unknown location:0: fatal error: in "GeneralStateTests/stEWASMTests": signal: SIGABRT (application abort requested)
/Users/distiller/project/test/tools/libtesteth/TestHelper.cpp:614: last checkpoint

This is for a line if (curr->imported()) { so it must be for EEI. How didn't this fail yesterday?

axic avatar Jan 22 '19 14:01 axic

How didn't this fail yesterday?

It did.

chfast avatar Jan 22 '19 15:01 chfast

There's a new release 1.38.28, maybe that will work on mac.

axic avatar Feb 25 '19 09:02 axic

I will check. There is one promising changelog entry: https://github.com/WebAssembly/binaryen/releases/tag/1.38.25.

chfast avatar Feb 25 '19 10:02 chfast

Binaryen is at 1.38.30, should try it.

axic avatar Apr 12 '19 19:04 axic

Need to also rebase.

axic avatar Apr 12 '19 19:04 axic