Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Wasmer with LLVM support #271

Open
thibaultcha opened this issue Apr 24, 2023 · 1 comment
Open

Build Wasmer with LLVM support #271

thibaultcha opened this issue Apr 24, 2023 · 1 comment
Labels
area/runtime Area: WebAssembly runtimes area/util Area: util/ scripts enhancement New feature or request

Comments

@thibaultcha
Copy link
Member

See thread at: #265

@thibaultcha thibaultcha added enhancement New feature or request area/runtime Area: WebAssembly runtimes area/util Area: util/ scripts labels Apr 24, 2023
@thibaultcha
Copy link
Member Author

Patch from the chore/local-builds-llvm branch which I am deleting (stale):

From 6f017b8a8084cefdad8d278109c4919d0920f7fd Mon Sep 17 00:00:00 2001
From: Hisham Muhammad <[email protected]>
Date: Wed, 19 Apr 2023 13:55:49 -0300
Subject: [PATCH] chore(*) enable LLVM in Wasmer build

---
 t/01-wasm/directives/002-compiler_directive.t |  1 -
 t/10-build/002-runtime_linking.t              |  2 +-
 util/runtimes/wasmer.sh                       | 22 +++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/t/01-wasm/directives/002-compiler_directive.t b/t/01-wasm/directives/002-compiler_directive.t
index 304fc626..2362b745 100644
--- a/t/01-wasm/directives/002-compiler_directive.t
+++ b/t/01-wasm/directives/002-compiler_directive.t
@@ -113,7 +113,6 @@ qr/\[info\] .*? \[wasm\] using wasmer with compiler: "singlepass"/
 
 
 === TEST 8: compiler directive - wasmer 'llvm'
---- SKIP
 --- skip_eval: 4: $::nginxV !~ m/wasmer/
 --- main_config
     wasm {
diff --git a/t/10-build/002-runtime_linking.t b/t/10-build/002-runtime_linking.t
index 98165846..52328c32 100644
--- a/t/10-build/002-runtime_linking.t
+++ b/t/10-build/002-runtime_linking.t
@@ -53,7 +53,7 @@ libwee8
 
 === TEST 4: build with statically linked runtime - wasmtime, wasmer
 --- skip_eval: 4: !( $ENV{NGX_WASM_RUNTIME} eq 'wasmtime' || $ENV{NGX_WASM_RUNTIME} eq 'wasmer' ) || $ENV{NGX_WASM_RUNTIME_DIR} eq '' || $ENV{NGX_WASM_RUNTIME} eq ''
---- build eval: qq{NGX_WASM_RUNTIME_INC="$ENV{NGX_WASM_RUNTIME_DIR}/include" NGX_WASM_RUNTIME_LD_OPT="$ENV{NGX_WASM_RUNTIME_DIR}/lib/lib$ENV{NGX_WASM_RUNTIME}.a -lm -ldl -lpthread" make}
+--- build eval: qq{NGX_WASM_RUNTIME_INC="$ENV{NGX_WASM_RUNTIME_DIR}/include" NGX_WASM_RUNTIME_LD_OPT="$ENV{NGX_WASM_RUNTIME_DIR}/lib/lib$ENV{NGX_WASM_RUNTIME}.a -lm -ldl -lpthread -lstdc++" make}
 --- no_grep_libs eval
 [
     qr/libwasmtime/,
diff --git a/util/runtimes/wasmer.sh b/util/runtimes/wasmer.sh
index 9086c82b..92d00e5f 100755
--- a/util/runtimes/wasmer.sh
+++ b/util/runtimes/wasmer.sh
@@ -110,6 +110,28 @@ build_wasmer() {
                 rm -rf target
             fi
 
+patch -p0 << EOF
+diff --git Makefile Makefile
+index 0123ebf7c9..1998f7ce07 100644
+--- Makefile
++++ Makefile
+@@ -260,11 +260,9 @@ comma := ,
+ compiler_features := --features \$(subst \$(space),\$(comma),\$(compilers)),wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load
+ capi_compilers_engines_exclude :=
+
+-# Define the compiler Cargo features for the C API. It always excludes
+-# LLVM for the moment because it causes the linker to fail since LLVM is not statically linked.
+-# TODO: Reenable LLVM in C-API
+-capi_compiler_features := --features \$(subst \$(space),\$(comma),\$(filter-out llvm, \$(compilers))),wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load
+-capi_compilers_engines_exclude += llvm-universal
++# Define the compiler Cargo features for the C API.
++capi_compiler_features := --features \$(subst \$(space),\$(comma),\$(compilers)),wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load
++capi_compilers_engines_exclude +=
+
+ # We exclude singlepass-universal because it doesn't support multivalue (required in wasm-c-api tests)
+ capi_compilers_engines_exclude += singlepass-universal
+EOF
+
             RUSTFLAGS=$NGX_BUILD_WASMER_RUSTFLAGS \
             ENABLE_LLVM=1 \
                 make build-capi

@thibaultcha thibaultcha changed the title Build Wasmer with LLVM Build Wasmer with LLVM support Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runtime Area: WebAssembly runtimes area/util Area: util/ scripts enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant