roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.45k stars 312 forks source link

REPL crashes on simple string eval #5797

Open dannicolici opened 1 year ago

dannicolici commented 1 year ago

I simply tried to follow the tutorial, installed the latest macos x86_64 nightly (11 Sep 2023), entered the repl and evaluated a string. This was the result:


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

Enter an expression, or :help, or :q to quit.

» "S"
ld: library not found for -lSystem
thread 'main' panicked at '
___________
Linking command failed with status ExitStatus(unix_wait_status(256)):

  Child { stdin: None, stdout: None, stderr: None, .. }
___________
', crates/compiler/build/src/link.rs:1305:5
stack backtrace:
   0:        0x10feabafb - __mh_execute_header
   1:        0x10f162b2b - __mh_execute_header
   2:        0x10fea601c - __mh_execute_header
   3:        0x10feab8da - __mh_execute_header
   4:        0x10feaf9c1 - __mh_execute_header
   5:        0x10feaf79f - __mh_execute_header
   6:        0x10feafeaa - __mh_execute_header
   7:        0x10feafdc5 - __mh_execute_header
   8:        0x10feae629 - __mh_execute_header
   9:        0x10feafb42 - __mh_execute_header
  10:        0x111166813 - __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm
  11:        0x10f45bf53 - __mh_execute_header
  12:        0x10fbc8db1 - __mh_execute_header
  13:        0x10fbd15d3 - __mh_execute_header
  14:        0x10f399d4d - __mh_execute_header
  15:        0x10f394116 - __mh_execute_header
  16:        0x10f394135 - __mh_execute_header
  17:        0x10fe9e88d - __mh_execute_header
  18:        0x10f39a9dc - __mh_execute_header
  19:     0x7ff804f5841f - <unknown>
Anton-4 commented 1 year ago

We've encountered a similar issue before that I was not able to reproduce on an m1 mac. ~I'll give this a try on an x86 mac~

EDIT: this will likely not reproduce there because the release is built on that x86 mac mini and this appears to be a library PATH issue.

dannicolici commented 1 year ago

Using macos 13.4.1

Anton-4 commented 1 year ago

This could be a possible workaround:

> export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
> export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
> roc repl
brian-carroll commented 1 year ago

I came back to this to try again. Tried that suggestion, with the latest nightly build, but it didn't work.

$ which roc
/Users/briancarroll/Downloads/roc_nightly-macos_apple_silicon-2023-09-29-648a02a/roc
$ export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
$ export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
$ roc repl

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

Enter an expression, or :help, or :q to quit.

» 123
ld: library not found for -lSystem
/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmp55lAS5/app.dylib: No such file or directory
thread 'main' panicked at '
___________
Linking command failed with status ExitStatus(unix_wait_status(256)):

  Child { stdin: None, stdout: None, stderr: None, .. }
___________
', crates/compiler/build/src/link.rs:1305:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Anton-4 commented 1 year ago

Thanks for trying, I now have a macos 13 device available and will get to this after fixing two higher priority issues.

Anton-4 commented 1 year ago

I was not able to reproduce this issue using macos 13.6 and the latest nightly. Can one of you check if this still happens?

brian-carroll commented 1 year ago

I'm still getting the same thing on Ventura 13.5 with M1 silicon


~/Downloads   
❯ roc_nightly-macos_apple_silicon-2023-10-24-ec1c221/roc repl

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

Enter an expression, or :help, or :q to quit.

» 123
ld: library not found for -lSystem
/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib: No such file or directory
thread 'main' panicked at 'we produce a valid Dylib: DlOpen { desc: "dlopen(/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib, 0x0005): tried: \'/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OS/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib\' (no such file), \'/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib\' (no such file), \'/private/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib\' (no such file), \'/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib\' (no such file), \'/private/var/folders/3l/k5hq6n8s1_b5vy4vt92yf79w0000gn/T/.tmprUv8jt/app.dylib\' (no such file)" }', crates/repl_cli/src/cli_gen.rs:71:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

~/Downloads   
❯ uname -a
Darwin Brians-MacBook-Pro-2.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
JanCVanB commented 1 year ago

Fedora Linux is unhappy with step #1 of the Roc Tutorial too :)

[jan@framey roc]$ neofetch
             .',;::::;,'.                jan@framey 
         .';:cccccccccccc:;,.            ---------- 
      .;cccccccccccccccccccccc;.         OS: Fedora release 38 (Thirty Eight) x86_64 
    .:cccccccccccccccccccccccccc:.       Host: Laptop AA 
  .;ccccccccccccc;.:dddl:.;ccccccc;.     Kernel: 6.5.8-200.fc38.x86_64 
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.    Uptime: 54 mins 
.:ccccccccccccc;KMMc;cc;xMMc:ccccccc:.   Packages: 2584 (rpm), 42 (nix-default), 44 (flatpak) 
,cccccccccccccc;MMM.;cc;;WW::cccccccc,   Shell: bash 5.2.15 
:cccccccccccccc;MMM.;cccccccccccccccc:   Resolution: 2256x1504 
:ccccccc;oxOOOo;MMM0OOk.;cccccccccccc:   DE: GNOME 44.5 
cccccc:0MMKxdd:;MMMkddc.;cccccccccccc;   WM: Mutter 
ccccc:XM0';cccc;MMM.;cccccccccccccccc'   WM Theme: Adwaita 
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;    Theme: Adwaita [GTK2/3] 
ccccc;0MNc.ccc.xMMd:ccccccccccccccc;     Icons: Adwaita [GTK2/3] 
cccccc;dNMWXXXWM0::cccccccccccccc:,      Terminal: kitty 
cccccccc;.:odl:.;cccccccccccccc:,.       CPU: 11th Gen Intel i5-1135G7 (8) @ 4.200GHz 
:cccccccccccccccccccccccccccc:'.         GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 
.:cccccccccccccccccccccc:;,..            Memory: 2545MiB / 15763MiB 
  '::cccccccccccccc::;,.

[jan@framey roc]$ 
[jan@framey roc]$ 
[jan@framey roc]$ roc version
roc: /lib64/libtinfo.so.6: no version information available (required by roc)
roc nightly pre-release, built from commit c509252 on Fr 27 Okt 2023 09:07:30 UTC
[jan@framey roc]$ 
[jan@framey roc]$ 
[jan@framey roc]$ roc repl
roc: /lib64/libtinfo.so.6: no version information available (required by roc)

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

Enter an expression, or :help, or :q to quit.

» "Alo, World!"
ld: /usr/lib/libgcc_s.so.1: error adding symbols: file in wrong format
thread 'main' panicked at 'we produce a valid Dylib: DlOpen { desc: "/tmp/.tmpLRkhvI/app.so.1.0: cannot open shared object file: No such file or directory" }', crates/repl_cli/src/cli_gen.rs:71:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[jan@framey roc]$ 
[jan@framey roc]$ 
[jan@framey roc]$ export RUST_BACKTRACE=full
[jan@framey roc]$ 
[jan@framey roc]$ 
[jan@framey roc]$ roc repl
roc: /lib64/libtinfo.so.6: no version information available (required by roc)

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

Enter an expression, or :help, or :q to quit.

» "trace time?"
ld: /usr/lib/libgcc_s.so.1: error adding symbols: file in wrong format
thread 'main' panicked at 'we produce a valid Dylib: DlOpen { desc: "/tmp/.tmpZyd289/app.so.1.0: cannot open shared object file: No such file or directory" }', crates/repl_cli/src/cli_gen.rs:71:14
stack backtrace:
   0:     0x556d6270b483 - <unknown>
   1:     0x556d61a9da7f - <unknown>
   2:     0x556d62706cf7 - <unknown>
   3:     0x556d6270b255 - <unknown>
   4:     0x556d6270ce10 - <unknown>
   5:     0x556d6270cbd4 - <unknown>
   6:     0x556d6270d319 - <unknown>
   7:     0x556d6270d224 - <unknown>
   8:     0x556d6270bad6 - <unknown>
   9:     0x556d6270cfa2 - <unknown>
  10:     0x556d6199dea3 - <unknown>
  11:     0x556d6199e343 - <unknown>
  12:     0x556d62428d6b - <unknown>
  13:     0x556d6242e96f - <unknown>
  14:     0x556d61c64074 - <unknown>
  15:     0x556d61c57263 - <unknown>
  16:     0x556d61c57283 - <unknown>
  17:     0x556d626fde95 - <unknown>
  18:     0x556d61c65365 - <unknown>
  19:     0x7f8249c49b8a - __libc_start_call_main
  20:     0x7f8249c49c4b - __libc_start_main_alias_2
  21:     0x556d61a3273e - <unknown>
  22:                0x0 - <unknown>
[jan@framey roc]$ 
JanCVanB commented 1 year ago

Nevermind about my Fedora issue - it seems to be fixed by #5942.

bhansconnect commented 1 year ago

Apparently this is an xcode issue of some sort. Some context here: https://github.com/actions/runner-images/issues/5531

This worked to fix it for me:

sudo xcode-select --switch /Applications/Xcode.app
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Note, in the first command, the folder can vary. For example, it could be: /Applications/Xcode_13.3.1.app

ryanb commented 1 year ago

I ran into the ld: library not found for -lSystem error as well when inputting a string in the repl. @bhansconnect's solution of reinstalling the developer command line tools worked for me. Mac OS X 13.6 on Intel here.