Stream: beginners

Topic: roc_bitcode v0.0.1 compiler error


view this post on Zulip Stéfan van der Walt (Nov 21 2023 at 00:30):

While compiling from source, I see the following error:

error: failed to run custom build command for `roc_bitcode v0.0.1 (/home/stefan/src/roc/crates/compiler/builtins/bitcode)`

Caused by:
  process didn't exit successfully: `/home/stefan/src/roc/target/debug/build/roc_bitcode-26668503bbc4355e/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  Compiling zig object `object` to: /home/stefan/src/roc/crates/compiler/builtins/bitcode/zig-out/builtins-host.o

  --- stderr
  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
  thread 'main' panicked at 'zig build object -Drelease=true failed 10 times in a row. The following error is unlikely to be a flaky error: error: unable to find zig installation directory '/home/stefan/.local/bin/zig': FileNotFound
  ', crates/compiler/builtins/bitcode/build.rs:179:25

LLVM 16
zig 0.12.0-dev.1664+8ca4a5240 (also tried with 0.9)
cargo 1.73.0

view this post on Zulip Brendan Hansknecht (Nov 21 2023 at 00:31):

I think we are on zig 0.11

view this post on Zulip Stéfan van der Walt (Nov 21 2023 at 00:34):

Thanks. With v0.11 I run into:

error: failed to run custom build command for `wasi_libc_sys v0.0.1 (/home/stefan/src/roc/crates/wasi-libc-sys)`

Caused by:
  process didn't exit successfully: `/home/stefan/src/roc/target/debug/build/wasi_libc_sys-717ef5db1191d761/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-changed=src/dummy.c

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', crates/wasi-libc-sys/build.rs:33:10

view this post on Zulip Brendan Hansknecht (Nov 21 2023 at 01:26):

Hmm, not sure. Maybe wasi libc has a system dependency? I always use nix and direnv to avoid dealing with dependencies.

view this post on Zulip Anton (Nov 21 2023 at 11:19):

Yes, using nix to build from source is highly recommended. For the first time, make sure to do cargo clean before doing cargo build --release --bin roc with nix, otherwise issues may arise from trying to re-use cached rust dependencies with non-nix dependencies.

view this post on Zulip Stéfan van der Walt (Nov 21 2023 at 23:41):

I've managed to compile the compiler. I made a PR here to clarify the issues I ran into: https://github.com/roc-lang/roc/pull/6059

view this post on Zulip Anton (Nov 22 2023 at 10:02):

Thanks @Stéfan van der Walt, I'll do the review :)


Last updated: Jul 05 2025 at 12:14 UTC