wasi-sdk icon indicating copy to clipboard operation
wasi-sdk copied to clipboard

Instructions for compiling `libclang_rt.builtins-wasm32.a`?

Open TerrorJack opened this issue 6 years ago • 5 comments

I'm trying to use clang-9 to compile and use wasi-sysroot, but additionally the libclang_rt.builtins-wasm32.a file is required to link into the final wasm module. It is not obvious how to build this file without building the llvm/clang submodules first, so it would be much appreciated if you can add relevant instructions. Thanks a lot!

TerrorJack avatar May 22 '19 07:05 TerrorJack

@TerrorJack Did you ever find out how to build libclang_rt.builtins-wasm32.a from source?

eric-nubix avatar Sep 20 '21 16:09 eric-nubix

libclang_rt.builtins-wasm32.a built a build of llvm's compiler-rt.

You can see how we build it as part of wasi-sdk here: https://github.com/WebAssembly/wasi-sdk/blob/1a953299860bbcc198ad8c12a21d1b2e2f738355/Makefile#L98-L124

sbc100 avatar Sep 20 '21 16:09 sbc100

If you don't want to build it from source you can download a prebuilt version of this library from one of the releases. e.g. https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-12

Then can most likely just copy this library into ./lib/clang/9.0.0/lib/wasi/ inside your existing clang installation.

sbc100 avatar Sep 20 '21 16:09 sbc100

Is it possible to build libclang_rt.builtins-wasm32.a with -phread?

turbolent avatar Oct 09 '22 21:10 turbolent

@turbolent, you mean build it manually or distribute it as a part of the release artifacts?

abrown avatar May 22 '23 16:05 abrown