Stream: beginners

Topic: Running apps with the wasm 4 platform


view this post on Zulip Isaac Van Doren (Jan 10 2024 at 04:49):

I am running on apple silicon with Zig 0.110 and w4 2.6.1.

When I try zig build run or run-native, I get this error

0 errors and 0 warnings found in 19 ms.
0 errors and 0 warnings found in 137 ms while successfully building:

    zig-cache/app.wasm
zig build-lib cart Debug wasm32-freestanding: error: warning: FileNotFound: /Users/isaacvando/Desktop/projects/roc-wasm4/zig-cacheapp.o
error: FileNotFound

zig build-lib cart Debug wasm32-freestanding: error: the following command exited with error code 1:
/Users/isaacvando/Desktop/projects/zig/build/zig build-lib --stack 14752 /Users/isaacvando/Desktop/projects/roc-wasm4/platform/host.zig /Users/isaacvando/Desktop/projects/roc-wasm4/zig-cache/app.o --cache-dir /Users/isaacvando/Desktop/projects/roc-wasm4/zig-cache --global-cache-dir /Users/isaacvando/.cache/zig --name cart -dynamic --import-memory --initial-memory=65536 --max-memory=65536 --export=start --export=update -target wasm32-freestanding -mcpu generic --listen=-
Build Summary: 2/5 steps succeeded; 1 failed (disable with --summary none)
run transitive failure
└─ run w4 transitive failure
   └─ zig build-lib cart Debug wasm32-freestanding failure
error: the following build command failed with exit code 1:
/Users/isaacvando/Desktop/projects/roc-wasm4/zig-cache/o/6e1d1bd168f264f13d26df7d1f7d170a/build /Users/isaacvando/Desktop/projects/zig/build/zig /Users/isaacvando/Desktop/projects/roc-wasm4 /Users/isaacvando/Desktop/projects/roc-wasm4/zig-cache /Users/isaacvando/.cache/zig run

Any suggestions to fix this?

view this post on Zulip Isaac Van Doren (Jan 10 2024 at 04:53):

My Zig cache looks like this

app.wasm h        o        tmp      z

view this post on Zulip Luke Boswell (Jan 10 2024 at 05:41):

What is the name of your .roc file? You will need to use -Dapp=path/to/roc/file.roc to tell zig to build a different file. zig build will default to the snake example

view this post on Zulip Luke Boswell (Jan 10 2024 at 05:43):

Or are you literally just writing zig build and you get this error?

view this post on Zulip Luke Boswell (Jan 10 2024 at 05:43):

This line looks interesting to me zig build-lib cart Debug wasm32-freestanding: error: warning: FileNotFound: /Users/isaacvando/Desktop/projects/roc-wasm4/zig-cacheapp.o I would expect to see an slash after the zig-cache and before app.o

view this post on Zulip Luke Boswell (Jan 10 2024 at 05:48):

Can you confirm in your build.zig you have this line lib.addObjectFile(.{ .path = "zig-cache/app.o" }); and the slash is there? If I remove that I get an identical error to you (also apple silicon with the same versions)

view this post on Zulip Luke Boswell (Jan 10 2024 at 05:50):

Other than that I'm not sure what this could be, hopefully Brendan will have some ideas

view this post on Zulip Brendan Hansknecht (Jan 10 2024 at 06:45):

try updating roc

view this post on Zulip Brendan Hansknecht (Jan 10 2024 at 06:46):

zig-cache/app.wasm

should say zig-cache/app.o in lastest roc (hopefully that is in the nightlies now)

view this post on Zulip Luke Boswell (Jan 10 2024 at 06:50):

Oh yeah, I forgot about that. Thanks @Brendan Hansknecht

view this post on Zulip Isaac Van Doren (Jan 10 2024 at 14:02):

Ah yeah that was it :sweat_smile:. Thank you!

I opened up a PR to add the "version" of Roc required https://github.com/lukewilliamboswell/roc-wasm4/pull/8


Last updated: Jul 06 2025 at 12:14 UTC