FS#63985 - [emscripten] Expects LLVM 10 while packed with version 9
Attached to Project:
Community Packages
Opened by Kay (asdf123101) - Wednesday, 02 October 2019, 01:50 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Wednesday, 18 March 2020, 20:07 GMT
Opened by Kay (asdf123101) - Wednesday, 02 October 2019, 01:50 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Wednesday, 18 March 2020, 20:07 GMT
|
Details
Description:
emcc expects clang version 10 while the clang comes with the package is of version 9. emcc -v shows emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.46 clang version 9.0.0 (/srcdest/llvm-project) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/lib/emscripten-llvm Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0 Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/9.1.0 Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/9.1.0 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 shared:WARNING: LLVM version appears incorrect (seeing "9.0", expected "10.0") shared:INFO: (Emscripten: Running sanity checks) Compilation also fails error: unknown warning option '-Wno-int-in-bool-context'; did you mean '-Wno-gnu-include-next'? [-Werror,-Wunknown-warning-option] Additional info: * package version(s): 1.38.46-1 Steps to reproduce: emcc -v |
This task depends upon
Closed by Sven-Hendrik Haase (Svenstaro)
Wednesday, 18 March 2020, 20:07 GMT
Reason for closing: Fixed
Additional comments about closing: I don't really know how to fix this properly but the current solution works kind of well.
Wednesday, 18 March 2020, 20:07 GMT
Reason for closing: Fixed
Additional comments about closing: I don't really know how to fix this properly but the current solution works kind of well.
```
Traceback (most recent call last):
File "/usr/lib/emscripten/emcc.py", line 3652, in <module>
sys.exit(run(sys.argv))
File "/usr/lib/emscripten/emcc.py", line 2205, in run
final = do_emscripten(final, target + '.mem', js_libraries)
File "/usr/lib/emscripten/emcc.py", line 452, in do_emscripten
emscripten.run(infile, outfile, memfile, js_libraries)
File "/usr/lib/emscripten/emscripten.py", line 2723, in run
shared.Settings.STRUCT_INFO = shared.Cache.get(generated_struct_info_name, generate_struct_info)
File "/usr/lib/emscripten/tools/cache.py", line 133, in get
temp = creator()
File "/usr/lib/emscripten/emscripten.py", line 2720, in generate_struct_info
gen_struct_info.main(['-q', '-c', '-o', out])
File "/usr/lib/emscripten/tools/gen_struct_info.py", line 556, in main
struct_info = inspect_code(header_files, cpp_opts, structs, defines)
File "/usr/lib/emscripten/tools/gen_struct_info.py", line 420, in inspect_code
info = shared.run_js(js_file[1]).splitlines()
File "/usr/lib/emscripten/tools/shared.py", line 1057, in run_js
engine = JS_ENGINES[0]
IndexError: list index out of range
```
So, it seems like this package needs more testing.
- Remove the "-Wno-int-in-bool-context" flag.
- Turn off "-Werror" when building system libs.
- Add include path "/usr/lib/emscripten/system/lib/libunwind/include" when building libcxxabi.
- Add "node" as the default JS engine.
distribution (emsdk install latest-upstream) works all fine.
And it bundles with clang 10.0.
As for the JS_ENGINES, when using "emsdk activate latest-upstream",
the "~/.emscripten" will have an entry to set JS_ENGINES to the
bundled nodejs.
e.g. currently it's 9ecacb0d54fb89dc7e6da66d9ecae934ca5c01d4.
1. cannot find "unwind.h"
2. list index out of range in "JS_ENGINES[0]"
where,
1. can be fixed by the attached patch (which should probably report to upstream). But the emsdk version do not need this change, strange.
2. can be fixed by adding this to prepare() in PKGBUILD to uncomment JS_ENGINES line in settings template:
sed -i 's|^#\s*\(JS_ENGINES\s*=\)|\1|' tools/settings_template_readonly.py
Can you post your patch upstream?
The emsdk version has bundled lib/clang/10.0.0/include which has unwind.h.
This emscripten package did not bundle that, and the Arch's clang is 8.0.1,
which has only /usr/lib/clang/8.0.1/include.
My patch asks libcxxabi to include the Emscripten-bundled libunwind,
which has unwind.h, but is not exactly the same as the clang's unwind.h.
I think this is still our packaging problem. We should probably:
- Put LLVM binaries into /usr/lib/emscripten-llvm/bin/
- Copy LLVM and clang headers into
/usr/lib/emscripten-llvm/lib/clang/10.0.0/include/
/usr/lib/emscripten-llvm/include/clang-c/
/usr/lib/emscripten-llvm/include/llvm-c/
- Compile clang with some option to look /usr/lib/emscripten-llvm/lib/clang/10.0.0/include/ and such for extra system headers.
- Remember to modify LLVM_ROOT in settings_template_readonly.py.
https://git.archlinux.org/svntogit/community.git/tree/trunk/arch-template.patch?h=packages/emscripten#n13
should be
+LLVM_ROOT = "/usr/lib/emscripten-llvm"
Except for that, it works.
But like I said, we should probably bundle lib/clang/10.0.0/include somehow like what the emsdk distribution does.
My libcxxabi-include-libunwind.patch was just a workaround to not bundling this.
It's a bit confusing, really.
Would be amazing if you could spend the time to make a patch for this to make it more like the emscripten-sdk (which I assume is more correct).