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

wasmtime explore doesn't support cross-compiling #6717

Open
jameysharp opened this issue Jul 12, 2023 · 1 comment
Open

wasmtime explore doesn't support cross-compiling #6717

jameysharp opened this issue Jul 12, 2023 · 1 comment
Labels
bug Incorrect behavior in the current implementation that needs fixing

Comments

@jameysharp
Copy link
Contributor

Steps to Reproduce

cargo run --features all-arch -- explore --target riscv64 crates/c-api/wasm-c-api/example/hello.wasm

If your native host is actually a riscv64 system, replace the target with something else such as x86_64.

Expected Results

Exploration written to crates/c-api/wasm-c-api/example/hello.explore.html

Actual Results

Error: compilation settings are not compatible with the native host

Caused by:
    target 'riscv64-unknown-unknown' specified in the configuration does not match the host

Versions and Environment

Wasmtime version or commit: c34567c

Operating system: Linux

Architecture: x86-64

Extra Info

Based on the error messages, apparently wasmtime explore winds up in Engine::check_compatible_with_native_host by way of Module::from_binary. I don't understand why this mode would use that path though.

Found this together with @michelledaviest while trying to understand some profiling results.

@jameysharp jameysharp added the bug Incorrect behavior in the current implementation that needs fixing label Jul 12, 2023
@alexcrichton
Copy link
Member

The reason for this is due to this line where a Module is created and a Module is "proof of ready to run" which in a cross-compiled case is impossible since the native platform is never ready to run a different platform. Awhile back this is why Engine::precompile_module was added which skips "is this ready to run" checks and is suitable for cross-compilation (or enabling more features than the host has, stuff like that).

The problem here though is that Module has a good deal of useful metadata about the module that precompile_module doesn't return (it just returns a Vec<u8>). One option though would be to return -> Result<PrecompiledModule> which packages up all the necessary information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing
Projects
None yet
Development

No branches or pull requests

2 participants