I'm on Linux trying to build/run some of the examples but they keep throwing an error for unable to find "dynhost":
~/External/basic-cli$ roc build.roc
🔨 Rebuilding platform...
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
failed to open file "platform/dynhost": No such file or directory (os error 2)
Location: crates/linker/src/lib.rs:552:29
Which version of Roc are you using?
latest nightly, roc nightly pre-release, built from commit 3215a8f on Mi 18 Sep 2024 09:01:58 UTC
Okay, I've reproduced
I think I understand the issue. Grabbing some links
@Luke Boswell I'm actually not quite sure what's happening here. Could you give some context?
Okay, I got it. We forgot to update the import in the build script to use a prebuilt version of the CLI: https://github.com/roc-lang/basic-cli/blob/0ac2f5ccb16c4ba503074511bc247f18440b565f/build.roc#L2
@Jared Cone please replace the line I linked above with the latest release of basic-cli: https://github.com/roc-lang/basic-cli/releases/tag/0.15.0
And then the instructions in the readme should work!
I'll make a PR to fix this
https://github.com/roc-lang/basic-cli/pull/249
Would appreciate an approval from any onlooking maintainer!
yep fixed, thanks!
do all the examples need to be updated to use the downloaded platform too?
Within basic-cli
, I don't believe so.
We try to strike a balance for now between "relative path platforms are lower maintenance" and "downloaded platforms are robust"
So in the future once package management is more deeply investigated, maybe that'll happen
But for now, it's staying as-is
Jared Cone said:
do all the examples need to be updated to use the downloaded platform too?
I've been thinking maybe we should rename these to tests or something. They're kind of serving two purposes at the moment. Maybe it's better to direct people to the examples repo instead, and add a label over there like basic-cli to it's easy to see which examples are using the platform.
We've got a new release process we will hopefully switch over to soon, and the idea is that roc main branch can move forwards independently of the platforms. But users of roc won't be affected as all the supported platforms will be kept in sync by using a recommended or latest release. So the URL version of examples will work, but we haven't really discussed the examples folder in the platforms
I think they should keep referring to the local path because we need them for CI and testing locally.
I'm trying to get a C host up and running using https://github.com/lukewilliamboswell/roc-platform-template-c as a starting point. I've got roc build.roc
working and it seems to be generating a platform/linux-x64.a
file. However when I run roc app.roc
it throws the same error as above:
roc app.roc
🔨 Rebuilding platform...
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
failed to open file "platform/dynhost": No such file or directory (os error 2)
Location: crates/linker/src/lib.rs:552:29
Try to run your application with "--linker legacy".
I think the roc-platform-template-c
only creates the files for the legacy linker. But on linux, the surgical linker is used as default. To fix this, would need also to create the dynhost file and the other files needed for the surgical linker.
This are the steps to do this:
libapp.so
by calling roc build main.roc --lib --output libapp.so
on this example.dynhost
by compiling your host (c-code) linked to the libapp.so
dynhost
inside your platform, next to the main.roc
-file inside the platform.roc preprocess-host PATH/TO/dynhost PATH/TO/PLATFORM/main.roc PATH/TO/libapp.so
, which creates to more files inside the platform.We dont have a std lib implementation ir a working glue spec for C yet, so things can get a bit challenging for more complicated platforms. Definitely something I am sure will exist in time, it's just needs some elbow grease to get there.. and the focus has been on rust mostly at this stage as things are still in flux on the platform development side of things.
Regarding building the prebuilt binaries for the legacy and surgical linkers, I made this diagram for basic-cli. It was on the README but we must have removed it at some point. That illustrates the process.
Oh, I guess we removed it because we had to change the layout of crates slightly to fix a segfault.
Yeah, it's linked in the crates README. The reasoning was that most people viewing the main README do not need details on the build process.
And in build.roc too
Oh nice, I hadn't noticed the crates README
Ah thanks, I guess I'd better stick with rust for that std lib :)
Last updated: Jul 06 2025 at 12:14 UTC