Skip to content

feat: add world selection for multi-world WIT files#394

Open
jsturtevant wants to merge 4 commits intomainfrom
rally/202-should-have-the-ability-to-select-a-world-from-a-w
Open

feat: add world selection for multi-world WIT files#394
jsturtevant wants to merge 4 commits intomainfrom
rally/202-should-have-the-ability-to-select-a-world-from-a-w

Conversation

@jsturtevant
Copy link
Contributor

Support WIT_WORLD_NAME env var in hyperlight-wasm-macro to select a specific world from WIT files containing multiple worlds.

@jsturtevant jsturtevant force-pushed the rally/202-should-have-the-ability-to-select-a-world-from-a-w branch from a6cbcbf to 99bb14e Compare February 26, 2026 00:45
@jsturtevant jsturtevant added the kind/enhancement New feature or request label Feb 26, 2026
@jsturtevant
Copy link
Contributor Author

@jprendes the build is failing on the sysprep root. I tried downgrading to cargo-hyperlight 0.1.6 and it didn't help. I Ideas what might be going on here? I don't see much in the error message that points me in the right direction.

error: failed to run custom build command for `hyperlight-wasm v0.12.0 (/mnt/vss/_work/hyperlight-wasm/hyperlight-wasm/src/hyperlight_wasm)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/mnt/vss/_work/hyperlight-wasm/hyperlight-wasm/target/release/build/hyperlight-wasm-bf817d45a9e5edbf/build-script-build` (exit status: 101)
  --- stdout
  cargo::rerun-if-changed=/mnt/vss/_work/hyperlight-wasm/hyperlight-wasm/src/hyperlight_wasm/vendor.tar
  cargo::rerun-if-changed=/mnt/vss/_work/hyperlight-wasm/hyperlight-wasm/src/wasm_runtime
  cargo::rerun-if-env-changed=WIT_WORLD
  cargo::rerun-if-env-changed=WIT_WORLD_NAME

  --- stderr

  thread 'main' panicked at src/hyperlight_wasm/build.rs:142:29:
  could not run cargo build wasm_runtime: Failed to prepare sysroot
  stack backtrace:
0:     0x598d505b6fd2 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf435e8e9347709a8
     1:     0x598d505dea33 - core::fmt::write::h0a51fad3804c5e7c
     2:     0x598d505b4073 - std::io::Write::write_fmt::h9759e4151bf4a45e
     3:     0x598d505b6e22 - std::sys::backtrace::BacktraceLock::print::h1ec5ce5bb8ee285e
     4:     0x598d505b97e6 - std::panicking::default_hook::{{closure}}::h5ffefe997a3c75e4
     5:     0x598d505b95e9 - std::panicking::default_hook::h820c77ba0601d6bb
     6:     0x598d505ba092 - std::panicking::rust_panic_with_hook::h8b29cbe181d50030
     7:     0x598d505b9f2a - std::panicking::begin_panic_handler::{{closure}}::h9f5b6f6dc6fde83e
     8:     0x598d505b74c9 - std::sys::backtrace::__rust_end_short_backtrace::hd7b0c344383b0b61
     9:     0x598d505b9bbd - __rustc[5224e6b81cd82a8f]::rust_begin_unwind
    10:     0x598d501753f0 - core::panicking::panic_fmt::hc49fc28484033487
    11:     0x598d5017bff5 - build_script_build::build_wasm_runtime::{{closure}}::hcab4f93392d6214b
    12:     0x598d50177d19 - core::result::Result<T,E>::unwrap_or_else::hf4503a4acb8d3053
    13:     0x598d5017b9c4 - build_script_build::build_wasm_runtime::h80241c44b074bee9
    14:     0x598d5017c053 - build_script_build::main::h954e73dda1497f74
    15:     0x598d501774f3 - core::ops::function::FnOnce::call_once::h1837b300b1ae8ae2
    16:     0x598d50177076 - std::sys::backtrace::__rust_begin_short_backtrace::h0d5841c8c6afd5eb
    17:     0x598d50176f49 - std::rt::lang_start::{{closure}}::hcdbca5790dc5dbbe
    18:     0x598d505adcf0 - std::rt::lang_start_internal::h31bbb7f936fd6b5d
    19:     0x598d50176f31 - std::rt::lang_start::hcaafe49941483598
    20:     0x598d5017e325 - main
    21:     0x7e5acaa29d90 - __libc_start_call_main
                                 at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    22:     0x7e5acaa29e40 - __libc_start_main_impl
                                 at ./csu/../csu/libc-start.c:392:3
    23:     0x598d50175cb5 - _start
    24:                0x0 - <unknown>

@jprendes
Copy link
Contributor

jprendes commented Mar 3, 2026

I changed src/hyperlight_wasm/build.rs lines 141-142

     cmd.status()
-        .unwrap_or_else(|e| panic!("could not run cargo build wasm_runtime: {}", e));
+        .unwrap_or_else(|e| panic!("could not run cargo build wasm_runtime: {:?}", e));

and now I got a more helpful error message

  thread 'main' panicked at src/hyperlight_wasm/build.rs:142:29:
  could not run cargo build wasm_runtime: Failed to prepare sysroot

  Caused by:
      0: Failed to get cargo metadata
      1: Command exited with code 101:
         cd "/home/jprendes/Projects/hyperlight-wasm/src/wasm_runtime" && env -i AR_x86_64_unknown_none="" (...) "/home/jprendes/.rustup/toolchains/1.89-x86_64-unknown-linux-gnu/bin/cargo" "metadata" "--format-version=1"
             Updating git repository `https://github.com/hyperlight-dev/hyperlight.git`
             Updating crates.io index
         error: failed to select a version for `indexmap`.
             ... required by package `wasmparser v0.245.1`
             ... which satisfies dependency `wasmparser = "^0.245.1"` of package `hyperlight-component-util v0.12.0 (https://github.com/hyperlight-dev/hyperlight.git?branch=main#4f8cae85)`
             ... which satisfies git dependency `hyperlight-component-util` of package `hyperlight-wasm-macro v0.12.0 (/home/jprendes/Projects/hyperlight-wasm/src/hyperlight_wasm_macro)`
             ... which satisfies path dependency `hyperlight-wasm-macro` (locked to 0.12.0) of package `wasm-runtime v0.12.0 (/home/jprendes/Projects/hyperlight-wasm/src/wasm_runtime)`
         versions that meet the requirements `^2.13.0` are: 2.13.0
         
         all possible versions conflict with previously selected packages.
         
           previously selected package `indexmap v2.12.1`
             ... which satisfies dependency `indexmap = "^2.0.0"` (locked to 2.12.1) of package `wasmtime v36.0.5`
             ... which satisfies dependency `wasmtime = "^36.0.5"` (locked to 36.0.5) of package `wasm-runtime v0.12.0 (/home/jprendes/Projects/hyperlight-wasm/src/wasm_runtime)`
         
         failed to select a version for `indexmap` which could resolve this conflict
         
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Recipe `check` failed on line 66 with exit code 101

@dblnz
Copy link
Contributor

dblnz commented Mar 4, 2026

It looks like hyperlight-component-util changed in this PR, needs a newer version of indexmap, while wasmtime 36.0.5 doesn't.

syntactically
syntactically previously approved these changes Mar 5, 2026
@jsturtevant
Copy link
Contributor Author

I will refresh this after #389 since it needs the last version of HL. I've also added a sample as a test case here.

@jsturtevant jsturtevant force-pushed the rally/202-should-have-the-ability-to-select-a-world-from-a-w branch from 99bb14e to a7cb892 Compare March 7, 2026 02:03
@jsturtevant
Copy link
Contributor Author

jsturtevant commented Mar 7, 2026

I added an additional sample for this use case. I also moved all the samples to a structure similiar to HL guests. This had been driving me crazy for awhile so sorry for the big diff. I can do that as a followup if want but can also look at each commit.

@jsturtevant jsturtevant force-pushed the rally/202-should-have-the-ability-to-select-a-world-from-a-w branch 5 times, most recently from e9ed446 to fd4c52e Compare March 10, 2026 20:16
Support WIT_WORLD_NAME env var in hyperlight-wasm-macro to select a specific world from WIT files containing multiple worlds.

Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
@jsturtevant jsturtevant force-pushed the rally/202-should-have-the-ability-to-select-a-world-from-a-w branch from 04191b4 to 9036213 Compare March 16, 2026 23:39
Copy link
Contributor

@ludfjig ludfjig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Does runcomponent_component_type.o file need to be commited? And I seem to remember our buildscript not only rebuilt if WIT_WORLD change, but also if the file that WIT_WORLD points to change. Did we remove that?

@jsturtevant
Copy link
Contributor Author

LGTM. Does runcomponent_component_type.o file need to be commited? And I seem to remember our buildscript not only rebuilt if WIT_WORLD change, but also if the file that WIT_WORLD points to change. Did we remove that?

ah good catch on that file, I guess the .gitignore is specific to which file instead of file endings. Let me update that.

I am not sure on the WIT_WORLD file changes. Will need to look more closely

@ludfjig
Copy link
Contributor

ludfjig commented Mar 17, 2026

LGTM. Does runcomponent_component_type.o file need to be commited? And I seem to remember our buildscript not only rebuilt if WIT_WORLD change, but also if the file that WIT_WORLD points to change. Did we remove that?

ah good catch on that file, I guess the .gitignore is specific to which file instead of file endings. Let me update that.

I am not sure on the WIT_WORLD file changes. Will need to look more closely

ok happy to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants