Skip to content

wasmtime run GC=no doesn't seem to disable GC in the host #11450

@jsturtevant

Description

@jsturtevant

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

Steps to Reproduce

Write a library that compiles your component with the following features from wasmtime:

wasmtime = { version="34", default-features = false, features = ["cranelift", "runtime", "component-model" ] }
    let mut config = Config::new();
  let engine = Engine::new(&config).unwrap();
  let bytes = std::fs::read(infile).unwrap();
  let serialized = if args.get_flag("component") {
      engine.precompile_component(&bytes).unwrap()
  } else {
      engine.precompile_module(&bytes).unwrap()
  };

Then try and run it in in wasmtime, turning off GC in the host, it fails to run:

wasmtime run -W gc=no -W component-model-gc=no --target x86_64-unknown-none --allow-precompiled --invoke 'echo("hi")' /home/jstur/projects/hyperlight-wasm/x64/debug/runcomponent.aot
Caused by:
    module was compiled without GC but GC is enabled in the host

Expected Results

I would expect that I can turn the features off and run them.

Actual Results

error module was compiled without GC but GC is enabled in the host

Versions and Environment

Wasmtime version or commit: any released version

Operating system: TODO

Architecture: TODO

Extra Info

Anything else you'd like to add?

I tracked it down to this being always on via build flag even though -W gc=no -W component-model-gc=no settings are turned off and causing a failure later on in processing.

https://github.com/bytecodealliance/wasmtime/blob/759ccdfaee65f8c470ccc5b8b63506a1af5cd32d/crates/wasmtime/src/config.rs#L2162C1-L2163C1

I moved this logic to use the gc flag and things worked. Then I found #10455 (comment) and wasn't sure what the correct solution is here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions