Where are <errno.h>
and all the other includes supposed to come from? I'm just running cargo run examples/hello-world/c-platform/helloC.roc
and getting:
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
Running `target/debug/roc examples/hello-world/c-platform/helloC.roc`
🔨 Rebuilding host...
thread '<unnamed>' panicked at 'Failed to rebuild host.c - stderr of the `clang` command was:
/Users/jared/clone/fork/roc/examples/hello-world/c-platform/host.c:1:10: fatal error: 'errno.h' file not found
#include <errno.h>
^~~~~~~~~
1 error generated.
', compiler/build/src/link.rs:1191:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', cli/src/build.rs:265:46
hm ok so I found errno.h in $(xcrun --show-sdk-path)/usr/include
, but I don't know what env vbl incantation to use to get rust to tell clang about it.
oh huh so println!
d the command that was being run (here https://github.com/rtfeldman/roc/blob/trunk/compiler/build/src/link.rs#L348), and ran it in my shell, and it worked just fine. Seems like rust isn't forwarding the CPATH
env vbl?
Hi @Jared, are you using nix? Setting everything up is quite complicated, which is why we recommend nix to do it quickly and reliably.
yeah I'm not using nix, because I'm stubborn and also I don't have a ton of free disk space to throw around :sweat_smile: but I did get things working eventually.
I'm curious how nix would fix the errno.h
issue though. Is it putting files in some (more) well-known place? Or installing llvm differently?
I'm not sure, I also have a setup that does not use nix and I've never seen this issue :shrug: It could be you've made some specific changes to your system in the past that result in this error.
yeah idk. this fixed it though https://github.com/rtfeldman/roc/pull/3212
Last updated: Jul 05 2025 at 12:14 UTC