Stream: beginners

Topic: List.map crashing in repl on macOS (installed via nix)


view this post on Zulip Peter Marreck (Sep 12 2024 at 01:42):

» List.map [0] Num.isEven

ld: invalid r_symbolnum=1 in '/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.o'
/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib: No such file or directory
thread 'main' panicked at crates/repl_cli/src/cli_gen.rs:69:14:
we produce a valid Dylib: DlOpen { desc: "dlopen(/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib, 0x0005): tried: \'/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OS/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib\' (no such file), \'/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib\' (no such file), \'/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib\' (no such file), \'/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpkZEnte/app.dylib\' (no such file)" }
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:45):

May be a temp directory permission issue?

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:46):

Can you run anything else in the repl?

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:46):

On m1 mac, I see:

» List.map [0] Num.isEven

[Bool.true] : List Bool

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:48):

Yep, I can run anything else (so far)

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:48):

I'm just going through the tutorial.
The same statement compiles fine if it's in a file, it just doesn't work in roc repl

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:49):

I have an M1 Mac here as well

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:50):

oh, I bet it is an xcode versioning issue with the new ld-prime

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:50):

Something related to this https://github.com/rust-lang/rustc_codegen_cranelift/issues/1456

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:52):

I know we have config in roc to sometimes use ld-classic, but maybe are versions are off

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:52):

in case it helps, here's the full RUST stacktrace
» List.map [1, 2] Num.isOdd
ld: invalid r_symbolnum=1 in '/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.o'
/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib: No such file or directory
thread 'main' panicked at crates/repl_cli/src/cli_gen.rs:69:14:
we produce a valid Dylib: DlOpen { desc: "dlopen(/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib, 0x0005): tried: \'/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OS/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib\' (no such file), \'/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib\' (no such file), \'/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib\' (no such file), \'/private/var/folders/98/rpg9_bzd0v750_810hh2gm0w0000gn/T/.tmpi1Czdt/app.dylib\' (no such file)" }
stack backtrace:
0: 0x106b27ac4 - std::backtrace_rs::backtrace::libunwind::trace::h89330013351db63c
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x106b27ac4 - std::backtrace_rs::backtrace::trace_unsynchronized::hef5ed454b5e9a42a
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x106b27ac4 - std::sys_common::backtrace::_print_fmt::h661fed69b93a32f7
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:68:5
3: 0x106b27ac4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0aa20ca08aeb683c
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:44:22
4: 0x106b4acc8 - core::fmt::rt::Argument::fmt::h0c1f3a7ec00b5b49
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/fmt/rt.rs:142:9
5: 0x106b4acc8 - core::fmt::write::h168dbafcf35bac68
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/fmt/mod.rs:1120:17
6: 0x106b236fc - std::io::Write::write_fmt::hdb0dd3f09dcf2281
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/io/mod.rs:1846:15
7: 0x106b278f8 - std::sys_common::backtrace::_print::h7d087ee39ce46706
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:47:5
8: 0x106b278f8 - std::sys_common::backtrace::print::h57b289e4b951ee17
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:34:9
9: 0x106b28e48 - std::panicking::default_hook::{{closure}}::h783b6c512154ec65
10: 0x106b28b90 - std::panicking::default_hook::hcdfa9e1e0f234a4f
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:292:9
11: 0x106b29284 - std::panicking::rust_panic_with_hook::h9aea678ca49d64cf
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:781:13
12: 0x106b29178 - std::panicking::begin_panic_handler::{{closure}}::ha16c3377e66deceb
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:659:13
13: 0x106b27f48 - std::sys_common::backtrace::__rust_end_short_backtrace::hea8fdda1ea8a4c0e
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:171:18
14: 0x106b28f00 - rust_begin_unwind
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
15: 0x106bb4030 - core::panicking::panic_fmt::h1cb43b60f5788132
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
16: 0x106bb43e4 - core::result::unwrap_failed::h71a35eff74d84b68
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/result.rs:1649:5
17: 0x104abf520 - roc_repl_cli::cli_gen::eval_llvm::hc28dd96e8dcaee1c
18: 0x104ac3ffc - roc_repl_cli::main::hb10e1401a496e987
19: 0x104a9fc38 - roc::main::hb3ee3f81639e89ec
20: 0x104a95738 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3efe5bd0824ccb9f
21: 0x104a95840 - std::rt::lang_start::{{closure}}::hfc09877eff05b4cf
22: 0x106b1b500 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h4ad1988d4a160680
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/ops/function.rs:284:13
23: 0x106b1b500 - std::panicking::try::do_call::h2331bfde8ef4cc3d
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
24: 0x106b1b500 - std::panicking::try::h8b8bd8b27e4c66f6
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
25: 0x106b1b500 - std::panic::catch_unwind::hae6cb7ed67951dea
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
26: 0x106b1b500 - std::rt::lang_start_internal::{{closure}}::hd4e8129122b055e2
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:148:48
27: 0x106b1b500 - std::panicking::try::do_call::h6feb7fafe6c6f753
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:554:40
28: 0x106b1b500 - std::panicking::try::h2fa734b49f8484d4
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:518:19
29: 0x106b1b500 - std::panic::catch_unwind::h487a42f5cf6b259f
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panic.rs:142:14
30: 0x106b1b500 - std::rt::lang_start_internal::h0e09503d2b7f298e
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:148:20
31: 0x104aa0cfc - _main

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:52):

can you run xcodebuild -version

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:53):

bash> xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:53):

hmmm. i guess i need the full xcode?

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:53):

how does that explain the error though? the missing dylib

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:57):

I don't think you should need it.

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:57):

Probably means we need a different way to detect versioning for ld. It comes with xcode, but it also exists with m1 mac by default

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:58):

I guess our xcode version check is failing so we are not passing in -ld_classic which is why your link is failing. That is at least my rough guess

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:58):

I didn't think I should need it either, but if I have to install it for now, that's OK I guess

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 01:58):

yeah, I think it would fix things if you install it now.

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:59):

already installing. it takes a while :)

view this post on Zulip Peter Marreck (Sep 12 2024 at 01:59):

will report back if it fixes it. can I help file a bug or something?

view this post on Zulip Peter Marreck (Sep 12 2024 at 02:01):

I wouldn't even begin to know how to add test coverage for something like this though. How do you simulate an entire xcode full install or commandline install? lol

view this post on Zulip Peter Marreck (Sep 12 2024 at 02:02):

I guess you could temporarily set LD_LIBRARY_PATH to some test directory and have some touched files in there in the locations you expect it to look for and then see if the detection logic works correctly

view this post on Zulip Peter Marreck (Sep 12 2024 at 02:03):

then you'd also need a way to script things to run in the REPL and that sounds tricky

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 02:04):

Yeah, testing may be hard. But a bug filed would be great. We need to setup a clean macos environment and figure out the correct flags for ld.

view this post on Zulip Peter Marreck (Sep 12 2024 at 02:04):

you could have roc repl take some argument with some code to try to run directly with it and then use that in the test

view this post on Zulip Peter Marreck (Sep 12 2024 at 02:06):

actually, probably easier to just make it accept a pipe and that way you could just pipe it whatever and then check its stdout

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 02:09):

I do think we test this compilation pipeline on macos in our integration tests. Not 100% the same, but would run the same linking command. I think our tests just run on a mac with xcode installed. So we also need to test on a mac without xcode installed

view this post on Zulip Brendan Hansknecht (Sep 12 2024 at 02:10):

cc @Anton for awareness. We may want to expand our macos tests to also run on a system without xcode installed.

view this post on Zulip Peter Marreck (Sep 12 2024 at 03:02):

Installing the full XCode caused the issue to go away!

view this post on Zulip Anton (Sep 13 2024 at 08:57):

#7075


Last updated: Jul 06 2025 at 12:14 UTC