Skip to content

Commit

Permalink
Remove cranelift from sys-default feature
Browse files Browse the repository at this point in the history
When using the Wasmer-WASI crate, the sys-default feature from
wasmer is depending upon, which causes the following to conflict:

[dependencies.wasmer]
version = "2.0"
default-features=false
features=["sys" , "compiler-singlepass", "engine-universal"]

[dependencies.wasmer-wasi]
version = "2.0"

Because wasmer-wasi "2.0" depends on wasmer with the default features,
which implies using cranelift, which conflicts with singlepass.

Fixes #2882
  • Loading branch information
fschutt committed Jul 5, 2022
1 parent e32ecdf commit 4a86f5d
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C

### Changed
- [#3003](https://github.com/wasmerio/wasmer/pull/3003) Remove RuntimeError::raise from public API
- [#3004](https://github.com/wasmerio/wasmer/pull/3004) Remove cranelift from wasi/sys-default feature, making it possible to select the compiler backend when depending on wasmer-wasi
- [#2946](https://github.com/wasmerio/wasmer/pull/2946) Remove dylib,staticlib engines in favor of a single Universal engine
- [#2949](https://github.com/wasmerio/wasmer/pull/2949) Switch back to using custom LLVM builds on CI

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ test-capi-integration-%:
cd lib/c-api/examples; WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-integration-//) WASMER_DIR=`pwd`/../../../package make run

test-wasi-unit:
$(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/wasi/Cargo.toml --release
$(CARGO_BINARY) test $(CARGO_TARGET) --manifest-path lib/wasi/Cargo.toml --release --features compiler-cranelift

test-wasi:
$(CARGO_BINARY) test $(CARGO_TARGET) --release --tests $(compiler_features) -- wasi::wasitests
Expand Down
7 changes: 5 additions & 2 deletions lib/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ compiler = [
"compiler",
"wasmer-compiler-llvm",
]
default-compiler = []
default-compiler = [
"wasmer-compiler/translator"
]
default-singlepass = [
"default-compiler",
"singlepass",
Expand All @@ -118,8 +120,9 @@ default-compiler = []
engine = ["sys"]
universal = [
"engine",
"wasmer-compiler/universal_engine"
]
default-engine = []
default-engine = ["default-universal"]
default-universal = [
"default-engine",
"universal",
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub use wasmer_compiler_cranelift::{Cranelift, CraneliftOptLevel};
#[cfg(feature = "llvm")]
pub use wasmer_compiler_llvm::{LLVMOptLevel, LLVM};

#[cfg(feature = "universal")]
#[cfg(feature = "compiler")]
pub use wasmer_compiler::{Universal, UniversalArtifact, UniversalEngine};

/// Version number of this crate.
Expand Down
6 changes: 5 additions & 1 deletion lib/api/src/sys/store.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use crate::sys::tunables::BaseTunables;
use std::fmt;
use std::sync::{Arc, RwLock};
#[cfg(any(feature = "compiler", feature = "default-compiler"))]
use wasmer_compiler::CompilerConfig;
use wasmer_compiler::{Engine, Tunables, Universal};
#[cfg(any(feature = "compiler", feature = "default-compiler"))]
use wasmer_compiler::Universal;
use wasmer_compiler::{Engine, Tunables};
use wasmer_vm::{init_traps, TrapHandler, TrapHandlerFn};

/// The store represents all global state that can be manipulated by
Expand All @@ -23,6 +26,7 @@ pub struct Store {
}

impl Store {
#[cfg(any(feature = "compiler", feature = "default-compiler"))]
/// Creates a new `Store` with a specific [`CompilerConfig`].
pub fn new(compiler_config: Box<dyn CompilerConfig>) -> Self {
let engine = Universal::new(compiler_config).engine();
Expand Down
6 changes: 5 additions & 1 deletion lib/wasi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ wasm-bindgen-test = "0.3.0"
tracing-wasm = "0.2"

[features]
default = ["sys-default"]
default = ["wasmer/sys", "wasmer/wat", "wasmer/default-engine", "sys", "logging", "host-fs", "sys-poll", "host-vnet"]

sys = ["wasmer/sys"]
sys-default = ["wasmer/sys-default", "sys", "logging", "host-fs", "sys-poll", "host-vnet" ]
sys-poll = []

compiler-singlepass = ["wasmer/default-singlepass"]
compiler-cranelift = ["wasmer/default-cranelift"]
compiler-llvm = ["wasmer/default-llvm"]

js = ["wasmer/js", "mem-fs", "wasmer-vfs/no-time", "getrandom/js", "chrono"]
js-default = ["js", "wasmer/js-default"]
test-js = ["js", "wasmer/js-default", "wasmer/wat"]
Expand Down
3 changes: 3 additions & 0 deletions lib/wasi/tests/envvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use std::env;

#[cfg(not(feature = "compiler-cranelift"))]
compile_error! {"These tests run only with the feature \"compiler-cranelift\" enabled. Use \"--features compiler-cranelift\" to enable it."}

fn get_env_var(var_name: &str) -> Result<String, env::VarError> {
env::var(var_name)
}
Expand Down
3 changes: 3 additions & 0 deletions lib/wasi/tests/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ use std::io::{Read, Write};
use wasmer::{Instance, Module, Store};
use wasmer_wasi::{Pipe, WasiState};

#[cfg(not(feature = "compiler-cranelift"))]
compile_error! {"These tests run only with the feature \"compiler-cranelift\" enabled. Use \"--features compiler-cranelift\" to enable it."}

mod sys {
#[test]
fn test_stdout() {
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/wast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0"
wasmer = { path = "../../../lib/api", version = "=2.3.0", default-features = false, features = ["experimental-reference-types-extern-ref"] }
wasmer-wasi = { path = "../../../lib/wasi", version = "=2.3.0" }
wasmer-wasi = { path = "../../../lib/wasi", version = "=2.3.0", features = ["compiler-cranelift"] }
wasmer-vfs = { path = "../../../lib/vfs", version = "=2.3.0" }
wast = "38.0"
serde = "1"
Expand Down

0 comments on commit 4a86f5d

Please sign in to comment.