FS#65526 - [emscripten] shared:ERROR: error parsing binaryen version

Attached to Project: Community Packages
Opened by Algunenano (Algunenano) - Monday, 17 February 2020, 10:44 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Tuesday, 25 February 2020, 12:06 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description: Error when compiling with emcc


Additional info:
* Package versions
* emscripten 1.39.7-1
* binaryen 1:90-1
* config and/or log files etc.

Steps to reproduce:
- Clean installation (emscripten wasn't installed before).
- Install emscripten and binaryen.
- Edit `~/.emscripten` to set up `BINARYEN_ROOT = "/usr/"`
- Try to build the default hello_world.c example:
```
$ emcc tests/hello_world.c
cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/home/raul/.emscripten_cache/is_vanilla.txt" for subsequent builds)
cache:INFO: - ok
shared:WARNING: LLVM version appears incorrect (seeing "9.0", expected "11.0")
shared:INFO: (Emscripten: Running sanity checks)
cache:INFO: generating system library: libc.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libc.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libcompiler_rt.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libcompiler_rt.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc-wasm.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libc-wasm.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libdlmalloc.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libdlmalloc.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libpthread_stub.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libpthread_stub.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc_rt_wasm.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libc_rt_wasm.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libsockets.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libsockets.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system asset: generated_struct_info.json... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/generated_struct_info.json" for subsequent builds)
shared:ERROR: error parsing binaryen version (wasm-opt (unable to determine version)). Please check your binaryen installation (/usr/bin/wasm-opt)
FAIL: Compilation failed!
```

Rolling back using the archive (https://archive.archlinux.org/packages/e/emscripten/) to emscripten-1.39.6-1-x86_64.pkg.tar.zst fixes it:
```
$ sudo pacman -U /tmp/emscripten-1.39.6-1-x86_64.pkg.tar.zst
...
$ emcc --clear-cache
...

$ emcc tests/hello_world.c
cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/home/raul/.emscripten_cache/is_vanilla.txt" for subsequent builds)
cache:INFO: - ok
shared:WARNING: LLVM version appears incorrect (seeing "9.0", expected "10.0")
cache:INFO: generating system library: libc.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libc.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libcompiler_rt.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libcompiler_rt.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc-wasm.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libc-wasm.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libdlmalloc.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libdlmalloc.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libpthread_stub.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libpthread_stub.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc_rt_wasm.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libc_rt_wasm.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libsockets.a... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/libsockets.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system asset: generated_struct_info.json... (this will be cached in "/home/raul/.emscripten_cache/wasm-obj/generated_struct_info.json" for subsequent builds)
cache:INFO: - ok
$ ls -al a.out.*
-rw-r--r-- 1 raul raul 111097 Feb 17 11:38 a.out.js
-rw-r--r-- 1 raul raul 21819 Feb 17 11:38 a.out.wasm
```


I've also tested it in a different PC with an upgrade from 1.39.6 to 1.39.7 and it also stopped working and shows the same error message.
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Tuesday, 25 February 2020, 12:06 GMT
Reason for closing:  Fixed
Comment by Jeremy Ong (banachtarski) - Thursday, 20 February 2020, 04:45 GMT
Same issue, same versions.
Comment by Algunenano (Algunenano) - Thursday, 20 February 2020, 11:31 GMT
The problem seems to come from wasm-opt not reporting its version correctly:
```
$ wasm-opt --version
wasm-opt (unable to determine version)
```

I've tested building binaryen from master (changing the PKGBUILD to use git/master/HEAD) and that fixed it. I also tried to rebuild binaryen 1.90-1 from source but it reproduced the issue again.

From the build logs:
```
-- No build type selected, default to Release
fatal: not a git repository: '/home/raul/dev/PKGBUILDs/binaryen/src/binaryen-version_90/.git'
CMake Warning at CMakeLists.txt:23 (message):
Error running git describe to determine version
```

It seems to be trying to read the version from .git, which doesn't exist in the source tarball. I'm not sure what's the proper way to fix it, maybe using `git+https://github.com/WebAssembly/binaryen.git#tag...` as source or edit the build/config.h and place the $pkgver there.
Comment by Algunenano (Algunenano) - Thursday, 20 February 2020, 11:35 GMT
There is a patch that changed this in trunk (https://github.com/WebAssembly/binaryen/pull/2578).
Comment by Algunenano (Algunenano) - Thursday, 20 February 2020, 12:00 GMT
I've fixed it with the attached PKGBUILD, which applies the PRs #2578 and #2580.
   PKGBUILD (1.5 KiB)
Comment by Attila Oláh (attilaolah) - Thursday, 20 February 2020, 20:13 GMT
I rebuilt from the PKGBUILD you uploaded and it indeed fixes the issue. Thanks for pulling in the patches!
Comment by Sven-Hendrik Haase (Svenstaro) - Sunday, 23 February 2020, 13:10 GMT
Try rel -2.
Comment by Algunenano (Algunenano) - Tuesday, 25 February 2020, 09:43 GMT
Testing with `binaryen 1:90-2` and `emscripten 1.39.8-1` the previous error is fixed but I get new one when building with `-O3`:
```
Unknown option '--minify-imports-and-exports-and-modules'
shared:ERROR: '/usr/bin/wasm-opt --minify-imports-and-exports-and-modules ../../sql/eburos.wasm -o ../../sql/eburos.wasm --mvp-features --strip-dwarf' failed (1)
```

The only way I could fix it is to build binaryen from master. Luckily binaryen just released version_91 so I tested building that instead and it also fixes it. I've attached the updated PKGBUILD.
   PKGBUILD (1.1 KiB)
Comment by Sven-Hendrik Haase (Svenstaro) - Tuesday, 25 February 2020, 10:35 GMT
Check version 91 in community then.
Comment by Algunenano (Algunenano) - Tuesday, 25 February 2020, 11:59 GMT
91 from community seems to be working fine. Thanks a lot!

Loading...