hyperlight-dev / hyperlight-dev/hyperlight-wasm
"Unsupported ELF header" when running Go-compiled WASM
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 728
- Forks
- 39
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 23
Description
Issue Description
I am trying to run a Go-compiled WASM module (testhyperlight-go.wasm) with hyperlight-wasm, but encounter the following error:
Error: GuestError(GuestError, "Error: failed to parse precompiled artifact as an ELF\n\nCaused by:\n Unsupported ELF header")
This occurs when attempting to load the WASM file in the modified examples/helloworld/main.rs test case (see Reproduction Steps below).
Reproduction Steps
-
Compile the Go WASM module:
bash GOOS=wasip1 GOARCH=wasm go build -o "testhyperlight-go.wasm"package main //go:wasmexport noReturnCal func noReturnCal() { result := 0 for i := 0; i < 100; i++ { result += i } } func main() {} -
Modify
examples/helloworld/main.rsto include the new test case:fn main() -> Result<()> { let tests = [ ( "HelloWorld.aot", "HelloWorld", "Message from Rust Example to Wasm Function".to_string(), ), ( "RunWasm.aot", "Echo", "Message from Rust Example to Wasm Function".to_string(), ), // New test case (Go WASM) ( "testhyperlight-go.wasm", "noReturnCal", "Message from Rust Example to Wasm Function".to_string(), ), ]; // ... (rest of the test logic) } -
Run the example and observe the error:
Result from calling HelloWorld Function in Wasm Module test case 0) is: 0 Result from calling Echo Function in Wasm Module test case 1) is: Message from Rust Example to Wasm Function Error: GuestError(GuestError, "Error: failed to parse precompiled artifact as an ELF\n\nCaused by:\n Unsupported ELF header")
Questions
- Does hyperlight-wasm currently support WASM files compiled with another compiler?
- Hyperlight provide
wasm-clang-builderto compile C file , but does hyperlight compatible with Go-compiled WASM (with WASI support, such as GOOS=wasip1 GOARCH=wasm go build).
- Hyperlight provide
- If not, are there any possible modifications that can make hyperlight-wasm work with Go-compiled WASM?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with examples/helloworld/main.rs and reproduce the failure by building testhyperlight-go.wasm with GOOS=wasip1 GOARCH=wasm, then running the example. Compare the Go-generated module with the existing HelloWorld.aot and RunWasm.aot cases, and inspect the wasm-clang-builder context mentioned in the issue. Done means support or the compatibility limitation is established, with any required changes identified and the example no longer producing the ELF-header error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, rust, wasm
- Domain
- backend, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100