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

feat(native-engine) Panic if gcc/clang-10 is missing #1619

Merged
merged 2 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/engine-native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bincode = "1.3"
leb128 = "0.2"
libloading = "0.6"
tempfile = "3.1"
which = "4.0"

[features]
# Enable the `compiler` feature if you want the engine to compile
Expand Down
6 changes: 6 additions & 0 deletions lib/engine-native/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use wasmer_engine::{Artifact, DeserializeError, Engine, EngineId, Tunables};
use wasmer_types::Features;
use wasmer_types::FunctionType;
use wasmer_vm::{SignatureRegistry, VMSharedSignatureIndex, VMTrampoline};
#[cfg(feature = "compiler")]
use which::which;

/// A WebAssembly `Native` Engine.
#[derive(Clone)]
Expand All @@ -27,6 +29,10 @@ impl NativeEngine {
/// Create a new `NativeEngine` with the given config
#[cfg(feature = "compiler")]
pub fn new(compiler: Box<dyn Compiler + Send>, target: Target, features: Features) -> Self {
if let Err(_) = which("gcc").or_else(|_| which("clang-10")) {
Hywan marked this conversation as resolved.
Show resolved Hide resolved
panic!("gcc/clang is not found, it is required for using the `NativeEngine`");
}
Hywan marked this conversation as resolved.
Show resolved Hide resolved

Self {
inner: Arc::new(Mutex::new(NativeEngineInner {
compiler: Some(compiler),
Expand Down