Skip to content

Commit

Permalink
Merge #1033
Browse files Browse the repository at this point in the history
1033: Improve default compiler story for wasmer cli r=MarkMcCaskey a=MarkMcCaskey

This PR needs the following to be ready to ship:

- [x] Verified make commands are still fine
- [x] Verified this doesn't do anything bad in CI

This PR adds:
- compile_error if no backend is specified in wasmer.rs
- readds clif as the default
- improves the error message saying "specified backend not found" to include the name of the backend that it couldn't find

Co-authored-by: Mark McCaskey <mark@wasmer.io>
Co-authored-by: Mark McCaskey <5770194+markmccaskey@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 6, 2019
2 parents b336726 + 0580a11 commit 63a5887
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## **[Unreleased]**

- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI
- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API.
- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version`
- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ serde = { version = "1", features = ["derive"] } # used by the plugin example
typetag = "0.1" # used by the plugin example

[features]
default = ["fast-tests", "wasi"]
default = ["fast-tests", "wasi", "backend-cranelift"]
"loader-kernel" = ["wasmer-kernel-loader"]
debug = ["wasmer-runtime-core/debug"]
trace = ["wasmer-runtime-core/trace"]
Expand Down
14 changes: 13 additions & 1 deletion src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ use std::{cell::RefCell, io::Write, rc::Rc};
#[cfg(feature = "backend-llvm")]
use wasmer_runtime_core::backend::BackendCompilerConfig;

#[cfg(not(any(
feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
)))]
compile_error!("Please enable one or more of the compiler backends");

#[derive(Debug, StructOpt)]
#[structopt(name = "wasmer", about = "Wasm execution runtime.", author)]
/// The options for the wasmer Command Line Interface
Expand Down Expand Up @@ -619,7 +626,12 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
}

let compiler: Box<dyn Compiler> = get_compiler_by_backend(options.backend, options)
.ok_or_else(|| "the requested backend is not enabled")?;
.ok_or_else(|| {
format!(
"the requested backend, \"{}\", is not enabled",
options.backend.to_string()
)
})?;

#[allow(unused_mut)]
let mut backend_specific_config = None;
Expand Down

0 comments on commit 63a5887

Please sign in to comment.