Stream: beginners

Topic: ✔ running the basic-cli examples


view this post on Zulip Brian Hicks (Jan 03 2024 at 21:05):

hey, I'm trying to run the basic-cli examples with the latest roc binary and not getting a lot of success. Looks like there are some missing symbols during linking:

$ roc build hello-world.roc
🔨 Rebuilding platform...
ld: Undefined symbols:
  _main, referenced from:
      <initial-undefines>
  _roc_dealloc, referenced from:
      _decrement_refcounted_ptr_8 in roc_appkXIKOc.o
  _roc_fx_stdoutLine, referenced from:
      _roc_fx_stdoutLine_fastcc_wrapper in roc_appkXIKOc.o
hello-world: No such file or directory
thread 'main' panicked at 'not yet implemented: gracefully handle `ld` (or `zig` in the case of wasm with --optimize) returning exit code Some(1)', crates/compiler/build/src/program.rs:1044:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Any ideas what could be going on here?

view this post on Zulip Brendan Hansknecht (Jan 03 2024 at 21:18):

macos?

view this post on Zulip Brendan Hansknecht (Jan 03 2024 at 21:18):

Any other system details?

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:19):

whoops, yes. Latest macOS.

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:19):

roc nightly pre-release, built from commit b1f7316fce0 on Wed Jan  3 10:32:05 UTC 2024

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:20):

on basic-cli 202794db7a2cc3ba3dd3c590aa68806fd82c15c7 (current main)

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:20):

on apple silicon

view this post on Zulip Brendan Hansknecht (Jan 03 2024 at 21:37):

hmm, can't repro on main, maybe an issue specfic to nightlies?

view this post on Zulip Brendan Hansknecht (Jan 03 2024 at 21:37):

seems weird though cause it is failing in ld

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:46):

that is interesting. Is there anything special that needs to be done to build from source now? I'm getting a bunch of missing symbols there too :thinking:

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:46):

specifically it's telling me "Undefined symbols for architecture x86_64" when I try to cargo build. Not sure why it's not ARM

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:47):

(I can past the whole error if you like but it's large)

view this post on Zulip Brendan Hansknecht (Jan 03 2024 at 21:50):

Interesting. I wonder if your system is for some reason emulating x86 with Rosetta for part of the build.

view this post on Zulip Brendan Hansknecht (Jan 03 2024 at 21:51):

Then the symbols are missing for aarch64 despite existing for x86 or the reverse

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:55):

I've had some weird stuff on this system from the get-go. Something about how I had to set up the main repo at this job means I have to pass arch -arm64 before all Homebrew commands, for instance.

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:56):

but building Roc like that doesn't work:

$ arch -arm64 cargo build
arch: posix_spawnp: cargo: Bad CPU type in executable

view this post on Zulip Brian Hicks (Jan 03 2024 at 21:57):

and the arch -arm64 doesn't change the issue in the platform :thinking:

view this post on Zulip Brendan Hansknecht (Jan 03 2024 at 22:33):

I would guess that arch -arm64 isn't recursive, so subcommands are still running via x86

view this post on Zulip Brian Hicks (Jan 03 2024 at 22:34):

I've had a lot of weird arch issues on this computer, and it looks like this might merely be the latest. I'm going to wipe it and try again.

view this post on Zulip Brian Hicks (Jan 04 2024 at 23:36):

I think this might be resolved. It turns out I had told Nix that this M2 mac was actually an Intel Mac, so it was set up all sideways to begin with. Unfortunately, I found that out by spending all day reimaging it. Sigh. (It wasn't just for this, though. I was having all sorts of weird problems that I think can be linked to this!)

view this post on Zulip Brian Hicks (Jan 04 2024 at 23:37):

YESSSSSS

$ cargo run -- run ../basic-cli/examples/hello-world.roc
    Finished dev [unoptimized + debuginfo] target(s) in 0.28s
     Running `target/debug/roc run ../basic-cli/examples/hello-world.roc`
🔨 Rebuilding platform...
Hello, World!

view this post on Zulip Notification Bot (Jan 04 2024 at 23:37):

Brian Hicks has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC