Stream: beginners

Topic: building c-platform example


view this post on Zulip Jared (Jun 10 2022 at 02:27):

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

view this post on Zulip Jared (Jun 10 2022 at 02:32):

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.

view this post on Zulip Jared (Jun 10 2022 at 02:38):

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?

view this post on Zulip Anton (Jun 10 2022 at 09:05):

Hi @Jared, are you using nix? Setting everything up is quite complicated, which is why we recommend nix to do it quickly and reliably.

view this post on Zulip Jared (Jun 10 2022 at 12:23):

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.

view this post on Zulip Jared (Jun 10 2022 at 13:22):

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?

view this post on Zulip Anton (Jun 10 2022 at 13:31):

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.

view this post on Zulip Jared (Jun 10 2022 at 13:38):

yeah idk. this fixed it though https://github.com/rtfeldman/roc/pull/3212


Last updated: Jul 05 2025 at 12:14 UTC