Stream: beginners

Topic: failed to rebuild host


view this post on Zulip Viktor Ferenczi (Apr 20 2022 at 22:47):

Following the tutorial on WSL Ubuntu 20.04.

Nightly ZIP build extracted: roc_nightly-linux_x86_64-20220420-07fcaf.tar.gz

Installation steps succeeded, but on running helloWorld on any of the three runtimes I get errors:

viktor@SIRIUS:~$ cd bin
viktor@SIRIUS:~/bin$ ll
total 109296
drwxr-xr-x 1 viktor viktor     4096 Apr 21 00:37 ./
drwxr-xr-x 1 viktor viktor     4096 Apr 21 00:40 ../
-rw-r--r-- 1 viktor viktor        0 Apr 20 23:22 .motd_shown
drwxr-xr-x 1 viktor viktor     4096 Apr 20 23:23 compiler/
drwxr-xr-x 1 viktor viktor     4096 Apr 20 23:23 examples/
-rwxr-xr-x 1 viktor viktor 70666608 Apr 20 11:34 roc*
drwxr-xr-x 1 viktor viktor     4096 Sep  7  2021 zig-linux-x86_64-0.8.1/
-rw-r--r-- 1 viktor viktor 41250060 Sep  7  2021 zig-linux-x86_64-0.8.1.tar.xz
viktor@SIRIUS:~/bin$ ./roc examples/hello-world/rust-platform/helloRust.roc
thread '<unnamed>' panicked at 'Failed to rebuild src/main.rs - stderr of the `cargo build` command was:
error: failed to load manifest for dependency `roc_std`

Caused by:
  failed to read `/home/viktor/bin/roc_std/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
', compiler/build/src/link.rs:1114: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:236:50
🔨 Rebuilding host... viktor@SIRIUS:~/bin$
viktor@SIRIUS:~/bin$
viktor@SIRIUS:~/bin$ ./roc examples/hello-world/zig-platform/helloZig.roc
thread '<unnamed>' panicked at 'Failed to rebuild host.zig - stderr of the `zig` command was:
ld.lld: error: cannot open /earthbuild/target/release/build/roc_builtins-415514521724d807/out/builtins-host.o: No such file or directory
error: LLDReportedFailure
', compiler/build/src/link.rs:1114: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:236:50
🔨 Rebuilding host... viktor@SIRIUS:~/bin$
viktor@SIRIUS:~/bin$
viktor@SIRIUS:~/bin$ ./roc examples/hello-world/c-platform/helloC.roc
thread '<unnamed>' panicked at 'Failed to rebuild host.c - stderr of the `clang` command was:
clang: error: no such file or directory: '/earthbuild/target/release/build/roc_builtins-415514521724d807/out/builtins-host.o'
', compiler/build/src/link.rs:1114: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:236:50
🔨 Rebuilding host... viktor@SIRIUS:~/bin$
viktor@SIRIUS:~/bin$

Any ideas what I missed? Looks like it is trying to access some path from the build host, which it should not, I guess...

view this post on Zulip Jared Cone (Apr 21 2022 at 01:09):

FWIW I'm running on WSL, but I run using the nix shell.

view this post on Zulip Anton (Apr 21 2022 at 07:09):

Hi @Viktor Ferenczi, thanks for bringing this to our attention. I've created an issue to add tests for this. I was able to reproduce the errors for the zig and c platform but not for the rust platform. Can you share the output of ls /home/viktor/bin/roc_std?

view this post on Zulip Anton (Apr 21 2022 at 11:44):

@Folkert de Vries did something change recently with how we use builtins-host.o?

view this post on Zulip Folkert de Vries (Apr 21 2022 at 11:47):

nothing comes to mind. I may be missing some context here

view this post on Zulip Anton (Apr 21 2022 at 17:31):

This appears to have been caused by using the surgical linker by default, PR #2859.

view this post on Zulip Richard Feldman (Apr 21 2022 at 19:01):

if that's the problem, you can opt out of it with --linker=legacy

view this post on Zulip Richard Feldman (Apr 21 2022 at 19:02):

does using that flag fix the problem?

view this post on Zulip Viktor Ferenczi (Apr 21 2022 at 19:44):

@Anton

viktor@SIRIUS:~$ ls -la /home/viktor/bin/roc_std
ls: cannot access '/home/viktor/bin/roc_std': No such file or directory

(It took me some time to find your moved message in Zulip. The link in the chat notification email does not follow the message if it is moved. Don't move messages. Copy them and replace the original with a trampoline. Otherwise people get confused. This chat client is strange, to say the least...)

view this post on Zulip Anton (Apr 22 2022 at 06:47):

@Viktor Ferenczi apologies, I'll remember that for next time.
The roc_std folder should be in the tar.gz, can you double-check that?

view this post on Zulip Anton (Apr 22 2022 at 06:48):

@Richard Feldman yes, the --linker=legacy flag fixes the problem, thanks :)

view this post on Zulip Anton (Apr 22 2022 at 06:51):

@Viktor Ferenczi once you copy over roc_std to your bin folder, the following commands should work:

./roc examples/hello-world/rust-platform/helloRust.roc
./roc examples/hello-world/zig-platform/helloZig.roc --linker=legacy
./roc examples/hello-world/helloWorld.roc --linker=legacy
./roc examples/hello-world/c-platform/helloC.roc --linker=legacy

view this post on Zulip Anton (Apr 22 2022 at 07:04):

I've set up a PR that mentions this workaround in the getting_started docs.

view this post on Zulip Richard Feldman (Apr 22 2022 at 12:06):

@Anton when you get a chance, can you open an issue about the symptom the --linker=legacy flag fixes? Eventually the goal is to remove that option, so this is a bug we'll need to fix! :big_smile:

view this post on Zulip Richard Feldman (Apr 22 2022 at 12:09):

oh wait is it https://github.com/rtfeldman/roc/issues/2913 ?

view this post on Zulip Viktor Ferenczi (Apr 22 2022 at 16:25):

Anton said:

Viktor Ferenczi once you copy over roc_std to your bin folder, the following commands should work: ...

Yes, the roc_std folder was in the nightly tar.gz. Indeed, after copying that folder they started to work with the --linker=legacy parameter.

Slowly getting there, actually running some Roc after a few days. :)

Maybe I need to use Linux is some other way than WSL. How do you run Linux?

view this post on Zulip Anton (Apr 23 2022 at 08:24):

I have a dual boot setup with one hard drive for Kubuntu 20.04 and a different hard drive for windows 10.

view this post on Zulip Anton (Apr 23 2022 at 08:25):

@Richard Feldman yes, that's the issue


Last updated: Jul 06 2025 at 12:14 UTC