Stream: beginners

Topic: macOS X


view this post on Zulip Oleksii Skidan (Nov 04 2021 at 12:13):

Here's the error I get when I do cargo run repl on macOS 11.6 on MacBook Pro M1.

ld: library not found for -lSystem
/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpJdp1ak/app.dylib: No such file or directory
thread 'main' panicked at 'Error loading compiled dylib for test: DlOpen { desc: "dlopen(/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpJdp1ak/app.dylib, 2): image not found" }', cli/src/repl/gen.rs:227:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: core::result::unwrap_failed
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1617:5
   3: core::result::Result<T,E>::expect
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1259:23
   4: roc_cli::repl::gen::gen_and_eval
             at ./cli/src/repl/gen.rs:226:19
   5: roc_cli::repl::eval_and_format
             at ./cli/src/repl.rs:242:5
   6: roc_cli::repl::main
             at ./cli/src/repl.rs:177:29
   7: roc::main
             at ./cli/src/main.rs:73:13
   8: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

view this post on Zulip Zeljko Nesic (Nov 04 2021 at 12:15):

ld: library not found for -lSystem

Can you verify it's installed?

view this post on Zulip Richard Feldman (Nov 04 2021 at 12:16):

System comes preinstalled on all Mac OSes, so it's definitely there! :big_smile:

view this post on Zulip Richard Feldman (Nov 04 2021 at 12:18):

I think this is most likely part of the "we don't have a working M1 build yet" story

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 12:22):

I'll try to investigate further if this is something we could fix easily.

view this post on Zulip Kevin Hovsäter (Nov 04 2021 at 12:29):

I got this yesterday. The solution was to rerun xcode-select —install. I got it after upgrading to macOS Monterey.

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 12:32):

Thanks, I'll try. I have Command Line Tools installed on my system though.

view this post on Zulip Kevin Hovsäter (Nov 04 2021 at 12:33):

I did as well. It just broke for some reason. I think I got a Xcode update at the same time.

view this post on Zulip Kevin Hovsäter (Nov 04 2021 at 12:37):

To be clear. I got an update to Xcode, opened it and it wanted to install some necessary tools. When it was done I ran xcode-select —install and it downloaded a new set of tools. Afterwards I ran cargo clean and rebuilt the REPL. Not sure if the order matters but it did solve the issue.

view this post on Zulip Kevin Hovsäter (Nov 04 2021 at 12:38):

Never seen the error prior, and it was working just fine before that. So I guess something recently changed. :smile:

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:15):

xcode-select -install helped a bit. The linker warning went away, but the rest of the problem remains:

thread 'main' panicked at 'Error loading compiled dylib for test: DlOpen { desc: "dlopen(/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpkLO1wT/app.dylib, 2): no suitable image found.  Did find:\n\t/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpkLO1wT/app.dylib: mach-o, but not built for platform macOS\n\t/private/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpkLO1wT/app.dylib: mach-o, but not built for platform macOS" }', cli/src/repl/gen.rs:227:14

My guess is that LLVM back-end created an x86_64 dylib, but the repl itself is arm64. Or maybe vice versa. I'll look into it some more later today.

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:43):

UPD: the issue seems to be that the arm64 is not yet supported.
thread 'main' panicked at 'TODO gracefully handle unsupported target architecture: Aarch64(Aarch64)', compiler/build/src/target.rs:83:14
It could be that my branch has become out of date since this Monday, IDK. At the moment the only workaround I can think of is cross-compiling Roc for x86_64 to run in Rosetta.
Thanks everyone for your help!

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:44):

what are you running? I was able to get the REPL working just now on arm

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:47):

I'm trying to evaluate this code in the REPL: 1 + 2. To launch the REPL I use this command:
env RUST_BACKTRACE=1 LLVM_SYS_120_PREFIX=/opt/llvm-12.0.1 cargo run repl

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:47):

you want the bin in the path too I think

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:48):

llvm-12.0.1/bin

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:49):

PATH=/opt/llvm-12.0.1/bin:$PATH

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:49):

Ha, okay. I've several LLVM versions on my system. 13.0.0 is the default one.

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:49):

Thanks, I'll try switching to 12 and see what happens. )

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:50):

brew doesn't automatically symlink the llvm binaries into my path for me

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:50):

I hoped that LLVM_SYS_120_PREFIX will be used to guide Roc where to find the binaries/libs and libexecs...

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:50):

I'm not using brew.

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:50):

ports?

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:51):

Nope, I've built it from source.

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:51):

yea that's fine, that's what I used to do cause brew had issues back when we were on v10 or something

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:52):

you want bin in the path as well because something at some point tries to run the llvm-as bin

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:52):

Screen-Shot-2021-11-04-at-9.29.51-AM.png
I have this helper

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 13:52):

My concern with it is that it seems to prefer x86_64 and not everything is arm64-ready. We ran into issues at work because several tools from Brew were run through Rosetta.

view this post on Zulip Lucas Rosa (Nov 04 2021 at 13:54):

makes sense, I'm not sure what this llvm is doing on my end, I imagine llvm has had builds for arm for a while

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 14:09):

Unfortunately, replacing llvm-13 with llvm-12 in my PATH did not help at all. I also made sure that it goes first in the PATH.

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 14:11):

env PATH=/opt/llvm-12.0.1/bin:${PATH} LLVM_SYS_120_PREFIX=/opt/llvm-12.0.1 RUST_BACKTRACE=full cargo run repl
   Compiling roc_std v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/roc_std)
   Compiling roc_builtins v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/builtins)
   Compiling roc_module v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/module)
   Compiling roc_types v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/types)
   Compiling roc_parse v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/parse)
   Compiling roc_unify v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/unify)
   Compiling roc_problem v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/problem)
   Compiling roc_fmt v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/fmt)
   Compiling roc_can v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/can)
   Compiling roc_solve v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/solve)
   Compiling roc_constrain v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/constrain)
   Compiling roc_mono v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/mono)
   Compiling roc_reporting v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/reporting)
   Compiling roc_gen_dev v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/gen_dev)
   Compiling roc_gen_llvm v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/gen_llvm)
   Compiling roc_gen_wasm v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/gen_wasm)
   Compiling roc_load v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/load)
   Compiling roc_ast v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/ast)
   Compiling roc_build v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/compiler/build)
   Compiling roc_linker v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/linker)
   Compiling roc_code_markup v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/code_markup)
   Compiling roc_docs v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/docs)
   Compiling roc_editor v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/editor)
   Compiling roc_cli v0.1.0 (/Users/oskid/Workspace/Personal/Roc/roc/cli)
    Finished dev [unoptimized + debuginfo] target(s) in 26.96s
     Running `target/debug/roc repl`

  The rockin’ roc repl
────────────────────────

Enter an expression, or :help, or :exit/:q.

» 1 + 2
thread 'main' panicked at 'Error loading compiled dylib for test: DlOpen { desc: "dlopen(/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpePEhlR/app.dylib, 2): no suitable image found.  Did find:\n\t/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpePEhlR/app.dylib: mach-o, but not built for platform macOS\n\t/private/var/folders/dd/c49j3qrd0b5by64p9c0qg0b40000gn/T/.tmpePEhlR/app.dylib: mach-o, but not built for platform macOS" }', cli/src/repl/gen.rs:227:14
stack backtrace:
   0:        0x10464f0d4 - std::backtrace_rs::backtrace::libunwind::trace::h3788418f13e49f6e
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:        0x10464f0d4 - std::backtrace_rs::backtrace::trace_unsynchronized::hf189cd7ee07b4d2b
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:        0x10464f0d4 - std::sys_common::backtrace::_print_fmt::hcd10aea219dfc188
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:67:5
   3:        0x10464f0d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha9fb0042c142196e
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:46:22
   4:        0x10466f868 - core::fmt::write::ha61991bf8ecf136a
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/fmt/mod.rs:1150:17
   5:        0x10464a9e4 - std::io::Write::write_fmt::h46c2e7b09a3411d3
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/io/mod.rs:1667:15
   6:        0x104650c4c - std::sys_common::backtrace::_print::h66fb61bcb7af7f3c
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:49:5
   7:        0x104650c4c - std::sys_common::backtrace::print::hd77bcd12ac793f65
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:36:9
   8:        0x104650c4c - std::panicking::default_hook::{{closure}}::h2e75467530bdcca8
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:210:50
   9:        0x104650818 - std::panicking::default_hook::habe288fd56f5750a
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:227:9
  10:        0x10465128c - std::panicking::rust_panic_with_hook::h0de8caef2b5cd059
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:624:17
  11:        0x104650dd8 - std::panicking::begin_panic_handler::{{closure}}::hacf45a4761576516
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:521:13
  12:        0x10464f5ac - std::sys_common::backtrace::__rust_end_short_backtrace::hc8935facac9e6044
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:141:18
  13:        0x104650d40 - rust_begin_unwind
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
  14:        0x1046c9de8 - core::panicking::panic_fmt::h976396c8435074ae
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
  15:        0x1046c9e8c - core::result::unwrap_failed::h0f27636d1d025391
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1617:5
  16:        0x1011af18c - core::result::Result<T,E>::expect::h90b1029189d9287a
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/result.rs:1259:23
  17:        0x101199200 - roc_cli::repl::gen::gen_and_eval::h620e393d7390fb10
                               at /Users/oskid/Workspace/Personal/Roc/roc/cli/src/repl/gen.rs:226:19
  18:        0x101195e2c - roc_cli::repl::eval_and_format::h15ca28ad12943e5d
                               at /Users/oskid/Workspace/Personal/Roc/roc/cli/src/repl.rs:242:5
  19:        0x101195b84 - roc_cli::repl::main::ha62e10eb62831db8
                               at /Users/oskid/Workspace/Personal/Roc/roc/cli/src/repl.rs:177:29
  20:        0x100b1b988 - roc::main::ha1f6e6621c5ab0dd
                               at /Users/oskid/Workspace/Personal/Roc/roc/cli/src/main.rs:73:13
  21:        0x100b1a550 - core::ops::function::FnOnce::call_once::h43b73a267c9310b5
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
  22:        0x100b18c3c - std::sys_common::backtrace::__rust_begin_short_backtrace::hfdf8467462b3251f
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/sys_common/backtrace.rs:125:18
  23:        0x100b1a1d0 - std::rt::lang_start::{{closure}}::hdfc2a698e27acbee
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/rt.rs:63:18
  24:        0x104651704 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h51c1d4e6d77bdcbb
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:259:13
  25:        0x104651704 - std::panicking::try::do_call::h89fe052533bafbda
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:403:40
  26:        0x104651704 - std::panicking::try::h46d7f0e49ad79887
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:367:19
  27:        0x104651704 - std::panic::catch_unwind::h39132fca9d95ef81
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panic.rs:129:14
  28:        0x104651704 - std::rt::lang_start_internal::{{closure}}::h6539b3c59dc74c9d
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/rt.rs:45:48
  29:        0x104651704 - std::panicking::try::do_call::h5b104bf56577bb16
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:403:40
  30:        0x104651704 - std::panicking::try::h7769cac6f81ef323
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:367:19
  31:        0x104651704 - std::panic::catch_unwind::h3b24c77fb952102f
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panic.rs:129:14
  32:        0x104651704 - std::rt::lang_start_internal::hb4d1fe995f6e94ee
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/rt.rs:45:20
  33:        0x100b1a194 - std::rt::lang_start::h71fcb53cbbdba727
                               at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/rt.rs:62:5
  34:        0x100b1cf30 - <unknown>
                               at /Users/oskid/Workspace/Personal/Roc/roc/cli/src/main.rs:12:55

view this post on Zulip Shritesh Bhattarai (Nov 04 2021 at 14:16):

I installed llvm@12 and zig via brew, rust via rustup and added export PATH="/opt/homebrew/opt/llvm@12/bin:$PATH" to my .zshrc and everything else worked fine on my M1

view this post on Zulip Shritesh Bhattarai (Nov 04 2021 at 14:18):

(except two failing tests, but that's above my understanding)

view this post on Zulip Oleksii Skidan (Nov 04 2021 at 14:23):

I'm new to Rust, looking at compiler/build/src/target.rs:77, I see that it needs target-aarch64 feature to be enabled .

    match target.architecture {
        Architecture::X86_64 => "x86-64",
        Architecture::X86_32(_) => "x86",
        Architecture::Aarch64(_) if cfg!(feature = "target-aarch64") => "aarch64",
        Architecture::Arm(_) if cfg!(feature = "target-arm") => "arm",
        Architecture::Wasm32 if cfg!(feature = "target-webassembly") => "wasm32",
        _ => panic!(
            "TODO gracefully handle unsupported target architecture: {:?}",
            target.architecture
        ),
    }

The part with if cfg!(feature = "target-aarch64") suggests that I have to change something in some configuration file. Could someone give me a hand where should I add this configuration setting?

view this post on Zulip Shritesh Bhattarai (Nov 04 2021 at 14:28):

Look at this comment: https://github.com/rtfeldman/roc/pull/1845#pullrequestreview-794693420 and the PR previous commit. I added it before but later removed it.


Last updated: Jul 05 2025 at 12:14 UTC