Stream: beginners

Topic: So close, Ubuntu


view this post on Zulip Matthew Griffith (Sep 05 2021 at 19:45):

Ok! I'm back. Booted up the ol' Ubuntu machine and after some classic shenanigans getting things up to date I'm now giving roc another go!

Versions of stuff:

But when running cargo run repl, I get

error: failed to run custom build command for `roc_builtins v0.1.0 (/home/matthias/Projects/roc/compiler/builtins)`

Caused by:
  process didn't exit successfully: `/home/matthias/Projects/roc/target/debug/build/roc_builtins-fc46a14962010627/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rustc-env=BUILTINS_O=/home/matthias/Projects/roc/target/debug/build/roc_builtins-2ac40a7585634db0/out/builtins.o
  Compiling zig object to: /home/matthias/Projects/roc/compiler/builtins/bitcode/builtins-host.o
  Compiling host ir to: /home/matthias/Projects/roc/compiler/builtins/bitcode/builtins-host.ll
  Compiling 32-bit i386 ir to: /home/matthias/Projects/roc/compiler/builtins/bitcode/builtins-i386.ll
  Compiling 32-bit wasm32 ir to: /home/matthias/Projects/roc/compiler/builtins/bitcode/builtins-wasm32.ll
  Moving zig object to: /home/matthias/Projects/roc/target/debug/build/roc_builtins-2ac40a7585634db0/out/builtins.o
  Compiling 32-bit bitcode to: /home/matthias/Projects/roc/compiler/builtins/bitcode/builtins-i386.bc

  --- stderr
  thread 'main' panicked at 'llvm-as failed: No such file or directory (os error 2)', compiler/builtins/build.rs:127:24
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Ohh wait I might have missed a step setting up llvm :thinking:

Hmm, maybe not. I forgot to do the symlink step mentioned here: https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md

But after doing that I still get the above issue.

Hmm, also looks like the referenced llvm installation script installs llvm 13.x as opposed to 12.x mentioned in the guide. That an issue?

oooo, things are movin now. switched the symlinks to refer to 13 instead of 12.

Oh snap I'm in the repl!! :tada: :tada:

view this post on Zulip Folkert de Vries (Sep 05 2021 at 20:20):

huh, llvm 13 is not even released ?! Are you using 12 or 13 now?

view this post on Zulip Richard Feldman (Sep 05 2021 at 20:28):

@Matthew Griffith congrats! :smiley:

you should also be able to run the examples now! e.g. cargo run examples/hello-world/Hello.roc

view this post on Zulip Richard Feldman (Sep 05 2021 at 20:29):

also cargo run edit to bring up the editor

view this post on Zulip Matthew Griffith (Sep 05 2021 at 20:30):

Folkert de Vries said:

huh, llvm 13 is not even released ?! Are you using 12 or 13 now?

13 I suppose. I just switched the symlinks to point to clang-13 and llvm-as-13 and things worked.

sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" installed 13

view this post on Zulip Matthew Griffith (Sep 05 2021 at 20:30):

Richard Feldman said:

also cargo run edit to bring up the editor

Sweet!

view this post on Zulip Folkert de Vries (Sep 05 2021 at 20:55):

well I suppose the good news is that our llvm12 -> 13 upgrade will be smooth if things just work already :smile:

view this post on Zulip Folkert de Vries (Sep 05 2021 at 20:55):

release is scheduled for end of september

view this post on Zulip Oliver Schöning (Oct 21 2021 at 14:57):

I have never tried to build anything from source :sweat_smile:
Just installed LLVM default via sudo apt install llvm
And cargo test gives me the following error:

   ...
   Compiling bytemuck v1.7.2
   Compiling palette v0.5.0
   Compiling futures-util v0.3.17
   Compiling glyph_brush v0.7.2
   Compiling zerocopy v0.3.0
error: could not find native static library `Polly`, perhaps an -L flag is missing?

error: could not compile `llvm-sys` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

Not seen this one anywhere mentioned. Unsure how to proceed

view this post on Zulip Oliver Schöning (Oct 21 2021 at 14:58):

LLVM version is 12. Perhaps that is the problem?

view this post on Zulip Shritesh Bhattarai (Oct 21 2021 at 15:00):

The Polly issue was painful to deal with in Zig too. IIRC LLVM themselves fixed this in subsequent releases.

view this post on Zulip Shritesh Bhattarai (Oct 21 2021 at 15:01):

I think it only manifested in MacOS targets there tho.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:04):

I'm on Pop!_OS, Ubuntu based. Just trying to figure out one error at a time. Previous one, as far as I could tell, was that LLVM wasnt installed.

I also installed zig via snapd if that helps

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:05):

So should I try and get a newer version of LLVM than 12 ? @Shritesh Bhattarai

view this post on Zulip Shritesh Bhattarai (Oct 21 2021 at 15:07):

Honestly, I don't know. Reading BUILDING_FROM_SOURCE.md, it seems like it is recommended to use LLVM's apt remote to install.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:11):

Hmmm... I might be in trouble then:

oliverschoning@pop-os:~/Projects/roc$ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
--2021-10-21 17:09:16--  https://apt.llvm.org/llvm.sh
Resolving apt.llvm.org (apt.llvm.org)... 2a04:4e42:38::561, 151.101.238.49
Connecting to apt.llvm.org (apt.llvm.org)|2a04:4e42:38::561|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3636 (3.6K) [application/octet-stream]
Saving to: ‘STDOUT’

-                       100%[============================>]   3.55K  --.-KB/s    in 0s

2021-10-21 17:09:17 (33.7 MB/s) - written to stdout [3636/3636]

[sudo] password for oliverschoning:
+ needed_binaries=(lsb_release wget add-apt-repository)
+ missing_binaries=()
+ for binary in "${needed_binaries[@]}"
+ which lsb_release
+ for binary in "${needed_binaries[@]}"
+ which wget
+ for binary in "${needed_binaries[@]}"
+ which add-apt-repository
+ [[ 0 -gt 0 ]]
+ LLVM_VERSION=13
+ '[' 0 -eq 1 ']'
++ lsb_release -is
+ DISTRO=Pop
++ lsb_release -sr
+ VERSION=21.04
+ DIST_VERSION=Pop_21.04
+ [[ 0 -ne 0 ]]
+ declare -A LLVM_VERSION_PATTERNS
+ LLVM_VERSION_PATTERNS[9]=-9
+ LLVM_VERSION_PATTERNS[10]=-10
+ LLVM_VERSION_PATTERNS[11]=-11
+ LLVM_VERSION_PATTERNS[12]=-12
+ LLVM_VERSION_PATTERNS[13]=-13
+ LLVM_VERSION_PATTERNS[14]=
+ '[' '!' _ ']'
+ LLVM_VERSION_STRING=-13
+ case "$DIST_VERSION" in
+ echo 'Distribution '\''Pop'\'' in version '\''21.04'\'' is not supported by this script (Pop_21.04).'
Distribution 'Pop' in version '21.04' is not supported by this script (Pop_21.04).
+ exit 2

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 15:22):

That just looks like the script doesn't realize pop is ubuntu

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 15:22):

You might need to slightly modify it to hardcode your distro as ubuntu.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:24):

That is the output of the sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
from https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:26):

Looking at apt.llvm.org Default Packages section now. I wonder if I can just run:

apt-get install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python-clang

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:27):

This is very new territory for me hehe. I am used to npm i :smiley:

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 15:29):

First you need to add the llvm ppa, then that would work correctly

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:30):

So am I understanding it correctly that the sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" is sugar for that longer sudo apt-get install ?

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:31):

These days I just download the llvm zip file

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:32):

On Linux mint

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 15:33):

Also, the script does a few more things than just an install command. This is the core:

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
add-apt-repository "${REPO_NAME}"
apt-get update
apt-get install -y clang-$LLVM_VERSION lldb-$LLVM_VERSION lld-$LLVM_VERSION clangd-$LLVM_VERSION

view this post on Zulip Oliver Schöning (Oct 21 2021 at 15:33):

Which zip and what version @Folkert de Vries ?

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:34):

from this page

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:34):

https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.0

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 15:35):

I think that should be 12.0.1 now

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:35):

then define your equvalent of this variable set -x LLVM_SYS_120_PREFIX "/home/folkertdev/Downloads/clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04"

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:35):

not with zig 0.8.0

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:35):

or at least, that is untested

view this post on Zulip Folkert de Vries (Oct 21 2021 at 15:36):

and then you may need to symlink some executables or add the /bin folder from the extracted archive to your PATH

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:04):

@Folkert de Vries hmm but I already have llvm 12 I think

oliverschoning@pop-os:~/Projects/roc$ llvm-config --version
12.0.0

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:05):

and zig 0.8.1

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:17):

Sorry what is failing then?

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:21):

I am running cargo test in the roc repo:

oliverschoning@pop-os:~/Projects/roc$ cargo test
   Compiling serde v1.0.130
   Compiling morphic_lib v0.1.0 (/home/oliverschoning/Projects/roc/vendor/morphic_lib)
   Compiling rkyv v0.6.7
   Compiling darling v0.13.0
   Compiling minimp3 v0.5.1
   Compiling futures-executor v0.3.17
   Compiling roc_parse v0.1.0 (/home/oliverschoning/Projects/roc/compiler/parse)
   Compiling roc_types v0.1.0 (/home/oliverschoning/Projects/roc/compiler/types)
   Compiling darling v0.10.2
   Compiling llvm-sys v120.2.1
   Compiling clap_derive v3.0.0-beta.1 (https://github.com/rtfeldman/clap?branch=master#e1d83a78)
   Compiling enumset_derive v0.5.5
   Compiling test_mono_macros v0.1.0 (/home/oliverschoning/Projects/roc/compiler/test_mono_macros)
error: could not find native static library `Polly`, perhaps an -L flag is missing?

error: could not compile `llvm-sys` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
oliverschoning@pop-os:~/Projects/roc$

I installed llvm via sudo apt install llvm

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:26):

can you define the shell variable like I showed, that might llvm-sys figure things out

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:31):

Sorry @Folkert de Vries but I am unfamilliar with setting a variable like this:
set -x LLVM_SYS_120_PREFIX "/home/folkertdev/Downloads/clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04"
I can set something in my .bashrc if that is the idea? But I also do not know the path like you specified since I did not download it into my home/username/Downloads folder.
Do you have some more hints so I can figure it out? :smile:

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:33):

allright first we need to figure out where llvm is actually installed

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:35):

first try which llvm-as

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:35):

/usr/bin/llvm-as

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:36):

and then that should hopefully be a symlink

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:36):

maybe ls -h /usr/bin/llvm-as works?

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:37):

oliverschoning@pop-os:~$ ls -h /usr/bin/llvm-as
/usr/bin/llvm-as

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:37):

actually try readlink -f /usr/bin/llvm-as

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:37):

Look at us, pair programming without a video share or call :grinning_face_with_smiling_eyes:

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:38):

oliverschoning@pop-os:~$ readlink -f /usr/bin/llvm-as
/usr/lib/llvm-12/bin/llvm-as

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:38):

cool, eh then in the .bashrc

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:39):

export LLVM_SYS_120_PREFIX="<that path>"

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:39):

actually, just /usr/lib/llvm-12

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:40):

and then I think source ~/.bashrc before you try running cargo again

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:40):

Just export /usr/... you mean?

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:41):

export LLVM_SYS_120_PREFIX="/usr/lib/llvm-12"

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:42):

Ok I did the source command

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:44):

right so then you can try compiling again

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:45):

(in the shell where you did the source)

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:50):

Oh, adding to .bashrc does not make it permanent to all terminals?

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:50):

oliverschoning@pop-os:~/Projects/roc$ source ~/.bashrc
oliverschoning@pop-os:~/Projects/roc$ cargo test
   Compiling object v0.25.3
   Compiling llvm-sys v120.2.1
   Compiling object v0.24.0
   Compiling petgraph v0.6.0
   Compiling serde_yaml v0.8.20
   Compiling typetag v0.1.7
   Compiling csv v1.1.6
   Compiling tinytemplate v1.2.1
   Compiling backtrace v0.3.61
   Compiling wasmer-types v2.0.0
   Compiling cranelift-codegen v0.74.0
   Compiling clap v3.0.0-beta.1 (https://github.com/rtfeldman/clap?branch=master#e1d83a78)
error: could not find native static library `Polly`, perhaps an -L flag is missing?

error: could not compile `llvm-sys` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
oliverschoning@pop-os:~/Projects/roc$

view this post on Zulip Oliver Schöning (Oct 21 2021 at 16:50):

Same error unfortunately

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:53):

makes it permanent in all new terminals, but does not change existing ones you have open

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:54):

here

I'm attempting to use LLVM bindings in Rust, the common bindings are the
llvm-sys crate. To link, they use

llvm-config-10 --link-static --libnames

to find all the libraries. That list includes libPolly.a which isn't
installed
as part of llvm-10 but is instead included in libclang-common-10-dev which
may or may not be installed.

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:54):

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966574

view this post on Zulip Folkert de Vries (Oct 21 2021 at 16:54):

you also need to install libclang-common-dev-12-dev it seems

view this post on Zulip Oliver Schöning (Oct 21 2021 at 17:00):

To make sure always the most recent versions of the packages are installed, we are providing some default packages.
To install all of them (currently version 14):
apt-get install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python-clang

https://apt.llvm.org/#default_pkg

view this post on Zulip Oliver Schöning (Oct 21 2021 at 17:00):

Maybe I need to manually install these then?

view this post on Zulip Oliver Schöning (Oct 21 2021 at 17:06):

I downloaded the llvm.sh file. Perhaps I can tweak it to accept my distro

view this post on Zulip Oliver Schöning (Oct 21 2021 at 17:11):

Its based on ubuntu 21.04. So just a wild guess that I can change the Ubuntu_21.04 to Pop_21.04

# find the right repository name for the distro and version
case "$DIST_VERSION" in
    Debian_9* )       REPO_NAME="deb http://apt.llvm.org/stretch/  llvm-toolchain-stretch$LLVM_VERSION_STRING main" ;;
    Debian_10* )      REPO_NAME="deb http://apt.llvm.org/buster/   llvm-toolchain-buster$LLVM_VERSION_STRING  main" ;;
    Debian_11* )      REPO_NAME="deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye$LLVM_VERSION_STRING  main" ;;
    Debian_unstable ) REPO_NAME="deb http://apt.llvm.org/unstable/ llvm-toolchain$LLVM_VERSION_STRING         main" ;;
    Debian_testing )  REPO_NAME="deb http://apt.llvm.org/unstable/ llvm-toolchain$LLVM_VERSION_STRING         main" ;;
    Ubuntu_16.04 )    REPO_NAME="deb http://apt.llvm.org/xenial/   llvm-toolchain-xenial$LLVM_VERSION_STRING  main" ;;
    Ubuntu_18.04 )    REPO_NAME="deb http://apt.llvm.org/bionic/   llvm-toolchain-bionic$LLVM_VERSION_STRING  main" ;;
    Ubuntu_18.10 )    REPO_NAME="deb http://apt.llvm.org/cosmic/   llvm-toolchain-cosmic$LLVM_VERSION_STRING  main" ;;
    Ubuntu_19.04 )    REPO_NAME="deb http://apt.llvm.org/disco/    llvm-toolchain-disco$LLVM_VERSION_STRING   main" ;;
    Ubuntu_19.10 )   REPO_NAME="deb http://apt.llvm.org/eoan/      llvm-toolchain-eoan$LLVM_VERSION_STRING    main" ;;
    Ubuntu_20.04 )   REPO_NAME="deb http://apt.llvm.org/focal/     llvm-toolchain-focal$LLVM_VERSION_STRING   main" ;;
    Ubuntu_21.04 )   REPO_NAME="deb http://apt.llvm.org/groovy/    llvm-toolchain-groovy$LLVM_VERSION_STRING  main" ;;
    Ubuntu_21.10 )   REPO_NAME="deb http://apt.llvm.org/hirsute/   llvm-toolchain-hirsute$LLVM_VERSION_STRING main" ;;
    * )
        echo "Distribution '$DISTRO' in version '$VERSION' is not supported by this script (${DIST_VERSION})."
        exit 2
esac

view this post on Zulip Oliver Schöning (Oct 21 2021 at 17:14):

Ohh
Something is happening

view this post on Zulip Oliver Schöning (Oct 21 2021 at 17:14):

Hmm, progress perhaps?

Get:11 http://us.archive.ubuntu.com/ubuntu hirsute-updates InRelease [115 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu hirsute-backports InRelease [101 kB]
Hit:10 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Fetched 326 kB in 2s (170 kB/s)
Reading package lists... Done
+ apt-get install -y clang-13 lldb-13 lld-13 clangd-13
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 liblldb-13 : Depends: libpython3.8 (>= 3.8.2) but it is not installable
E: Unable to correct problems, you have held broken packages.

view this post on Zulip Lucas Rosa (Oct 21 2021 at 17:57):

On Linux I’ve had a good time with llvmenv

view this post on Zulip Folkert de Vries (Oct 21 2021 at 17:59):

hmm llvm13 is definitely not what you want

view this post on Zulip Folkert de Vries (Oct 21 2021 at 18:00):

this is why I download that zip: it's a bit of work, but at least it's all simple stuff, no fighting with shell scripts or anything like that

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 18:16):

You can pass a number to the shell script for the version you want to install

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 18:16):

Just an FYI

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:04):

Ok a little update
I ran

apt-get install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python-clang

And I think I am pretty close now?

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:05):

Output too long, here is a hastebin:
https://hastebin.com/uwoqebigep.rb

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:06):

It seems to run the cargo test now, but a lot of failures:

failures:
    cli_run::astar
    cli_run::base64
    cli_run::cfold
    cli_run::cli
    cli_run::closure
    cli_run::deriv
    cli_run::effect
    cli_run::fib
    cli_run::hello_rust
    cli_run::hello_world
    cli_run::hello_zig
    cli_run::nqueens
    cli_run::quicksort
    cli_run::rbtree_ck
    cli_run::rbtree_insert
    cli_run::run_multi_dep_str_optimized
    cli_run::run_multi_dep_str_unoptimized
    cli_run::run_multi_dep_thunk_optimized
    cli_run::run_multi_dep_thunk_unoptimized

test result: FAILED. 2 passed; 19 failed; 0 ignored; 0 measured; 0 filtered out; finished in 9.26s

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:07):

Interesting. Some sort of linker argument error.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:08):

Well, I am, for the first time, able to run the repl! I call that success :D

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:09):

Well.. babysteps :joy:

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

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

» 1 +1
ld: Error: unable to disambiguate: -arch (did you mean --arch ?)
thread 'main' panicked at 'Error loading compiled dylib for test: DlOpen { desc: "/tmp/.tmpYFlZpw/app.so.1.0: cannot open shared object file: No such file or directory" }', cli/src/repl/gen.rs:227:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:10):

Hmm. I see some comments in the code related to this error, but not sure of the correct fix at the moment.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:11):

oliverschoning@pop-os:~/Projects/roc/examples$ cargo run hello-world/Hello.roc
    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
     Running `/home/oliverschoning/Projects/roc/target/debug/roc hello-world/Hello.roc`
ld: Error: unable to disambiguate: -arch (did you mean --arch ?)
oliverschoning@pop-os:~/Projects/roc/examples$

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:11):

I think the fix might be for me to go to my storage room and get my macbook 2012 :joy:

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:12):

What do you get when you run ld --version

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:12):

oliverschoning@pop-os:~/Projects/roc/examples$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.36.1
Copyright (C) 2021 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public Licence version 3 or (at your option) a later version.
This program has absolutely no warranty.

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:12):

Also, roc should run on Ubuntu or pop just fine. I exclusively use Linux.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:13):

I'm sure it will eventually work on my machine since it's ubuntu based. I am only mentioning osx coz a buddy tried roc today and had it working almost immediately hehe

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:14):

Fair enough

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:15):

But I would like to avoid having to run triple boot just to get this working. Id like to stay dual booted

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:16):

I get no hits on google for " -arch (did you mean --arch ?)"

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:18):

Can you try pulling and running theupdate-arch branch?

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:18):

See if that fixes it for you?

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:18):

Brendan Hansknecht said:

First you need to add the llvm ppa, then that would work correctly

you mentioned this @Brendan Hansknecht , I did not do this. Maybe that is why?

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:19):

That shouldn't be the cause of this issue cause it is caused by ld which is gnu, not llvm

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:19):

ok, so I'm gonna try switching to that branch

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:20):

I can only see a fix-arch-docs, that one?

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:21):

oliverschoning@pop-os:~/Projects/roc$ git status
On branch fix-arch-docs
Your branch is up-to-date with 'origin/fix-arch-docs'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    cli/tests/
    compiler/
    examples/

nothing added to commit but untracked files present (use "git add" to track)
oliverschoning@pop-os:~/Projects/roc$ cargo test
    Updating git repository `https://github.com/TheDan64/inkwell`
error: failed to get `inkwell` as a dependency of package `roc v0.1.0 (/home/oliverschoning/Projects/roc)`

Caused by:
  failed to load source for dependency `inkwell`

Caused by:
  Unable to update https://github.com/TheDan64/inkwell?branch=llvm8-0#aeba58a7

Caused by:
  object not found - no match for id (aeba58a7c684b27416b55bc1e53e4d2bee15c5ec); class=Odb (9); code=NotFound (-3)
oliverschoning@pop-os:~/Projects/roc$

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:23):

oh wait. I see it now

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:23):

make sure to git pull I just made the branch

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:33):

A unfortunately same issue. The cargo test hangs right now and a lot of failed. And Cargo run gives:

oliverschoning@pop-os:~/Projects/roc/examples$ cargo run hello-world/Hello.roc
   Compiling rand_core v0.4.2
   Compiling rand v0.8.4
   Compiling wyhash v0.3.0
   Compiling roc_collections v0.1.0 (/home/oliverschoning/Projects/roc/compiler/collections)
   Compiling roc_module v0.1.0 (/home/oliverschoning/Projects/roc/compiler/module)
   Compiling ven_graph v2.0.5-pre (/home/oliverschoning/Projects/roc/vendor/pathfinding)
   Compiling tempfile v3.2.0
   Compiling twox-hash v1.6.1
   Compiling wasmer-engine-dylib v2.0.0
   Compiling glyph_brush v0.7.2
   Compiling wgpu_glyph v0.14.1
   Compiling wasmer v2.0.0
   Compiling wasmer-wasi v2.0.0
   Compiling roc_types v0.1.0 (/home/oliverschoning/Projects/roc/compiler/types)
   Compiling roc_parse v0.1.0 (/home/oliverschoning/Projects/roc/compiler/parse)
   Compiling roc_builtins v0.1.0 (/home/oliverschoning/Projects/roc/compiler/builtins)
   Compiling roc_unify v0.1.0 (/home/oliverschoning/Projects/roc/compiler/unify)
   Compiling roc_problem v0.1.0 (/home/oliverschoning/Projects/roc/compiler/problem)
   Compiling roc_fmt v0.1.0 (/home/oliverschoning/Projects/roc/compiler/fmt)
   Compiling roc_can v0.1.0 (/home/oliverschoning/Projects/roc/compiler/can)
   Compiling roc_solve v0.1.0 (/home/oliverschoning/Projects/roc/compiler/solve)
   Compiling roc_constrain v0.1.0 (/home/oliverschoning/Projects/roc/compiler/constrain)
   Compiling roc_mono v0.1.0 (/home/oliverschoning/Projects/roc/compiler/mono)
   Compiling roc_reporting v0.1.0 (/home/oliverschoning/Projects/roc/compiler/reporting)
   Compiling roc_gen_llvm v0.1.0 (/home/oliverschoning/Projects/roc/compiler/gen_llvm)
   Compiling roc_gen_wasm v0.1.0 (/home/oliverschoning/Projects/roc/compiler/gen_wasm)
   Compiling roc_load v0.1.0 (/home/oliverschoning/Projects/roc/compiler/load)
   Compiling roc_ast v0.1.0 (/home/oliverschoning/Projects/roc/ast)
   Compiling roc_gen_dev v0.1.0 (/home/oliverschoning/Projects/roc/compiler/gen_dev)
   Compiling roc_build v0.1.0 (/home/oliverschoning/Projects/roc/compiler/build)
   Compiling roc_linker v0.1.0 (/home/oliverschoning/Projects/roc/linker)
   Compiling roc_code_markup v0.1.0 (/home/oliverschoning/Projects/roc/code_markup)
   Compiling roc_docs v0.1.0 (/home/oliverschoning/Projects/roc/docs)
   Compiling roc_editor v0.1.0 (/home/oliverschoning/Projects/roc/editor)
   Compiling roc_cli v0.1.0 (/home/oliverschoning/Projects/roc/cli)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 02s
     Running `/home/oliverschoning/Projects/roc/target/debug/roc hello-world/Hello.roc`
ld: Error: unable to disambiguate: --arch (did you mean ---arch ?)

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:34):

oliverschoning@pop-os:~/Projects/roc$ cargo run repl
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `target/debug/roc repl`

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

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

» 1 + 1
ld: Error: unable to disambiguate: --arch (did you mean ---arch ?)
thread 'main' panicked at 'Error loading compiled dylib for test: DlOpen { desc: "/tmp/.tmpmH53wB/app.so.1.0: cannot open shared object file: No such file or directory" }', cli/src/repl/gen.rs:227:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
oliverschoning@pop-os:~/Projects/roc$

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:37):

I just pushed one more commit to temporarily disable the arch flag, can you pull and run one more time? I am really confused as to the issue your version of ld is having the the arch flag.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:42):

Will do! Most likely I messed up the install I assume

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:51):

https://hastebin.com/aziporewec.rust <- cargo test

oliverschoning@pop-os:~/Projects/roc/examples$ cargo run hello-world/Hello.roc
    Blocking waiting for file lock on build directory
warning: unused import: `crate::target::arch_str`
 --> compiler/build/src/link.rs:1:5
  |
1 | use crate::target::arch_str;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `arch`
   --> compiler/build/src/link.rs:726:9
    |
726 |     let arch = match target.architecture {
    |         ^^^^ help: if this is intentional, prefix it with an underscore: `_arch`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: `roc_build` (lib) generated 2 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 15.37s
     Running `/home/oliverschoning/Projects/roc/target/debug/roc hello-world/Hello.roc`
Error: Os { code: 26, kind: ExecutableFileBusy, message: "Text file busy" }
oliverschoning@pop-os:~/Projects/roc/examples$

I was hower able to write 1 + 1 in the repl this time!

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:53):

Oh, you need to install valgrind

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:54):

Should just be an sudo apt install valgrind

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:57):

Omg it worked!
Now only one tests fails and I was able to run helloworld!
test cli_run::astar ... FAILED <- this test

view this post on Zulip Oliver Schöning (Oct 21 2021 at 19:57):

Thank you very much @Brendan Hansknecht

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 19:59):

If you run the tests again or just that test alone, does it consistently fail. I think our tests have a minor filesystem race condition that hasn't been fixed yet.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 20:05):

How can I run a single test?

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:09):

cargo test --test cli_run deriv should run just the deriv cli test

view this post on Zulip Oliver Schöning (Oct 21 2021 at 20:16):

I have re-run the all tests a couple of times. Sometimes they hang:

test cli_run::cfold has been running for over 60 seconds
test cli_run::cli has been running for over 60 seconds

Sometimes a test fails, never the same, sometimes they all pass.

Very confusing

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:18):

yea that happens, seems like you're hit hard by it though

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:18):

there is some race condition in there

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:18):

does cargo test --test cli_run -- --test-threads 1 work?

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:19):

(it is going to be slow, but it should be correct)

view this post on Zulip Oliver Schöning (Oct 21 2021 at 20:23):

Running it now. Why are tests sometimes failing tho? That's not how I usually expect unit tests to work haha

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 20:26):

Those are integration tests and a number of them generate the same file. So sometimes they delete the file while another test is using it. I thought we set them to run sequentially but I guess it doesn't work.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 20:27):

Result from:
cargo test --test cli_run -- --test-threads 1

``oliverschoning@pop-os:~/Projects/roc$ cargo test --test cli_run -- --test-threads 1 warning: unused import: crate::target::arch_str --> compiler/build/src/link.rs:1:5 | 1 | use crate::target::arch_str; | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unused_imports)]` on by default

warning: unused variable: arch
--> compiler/build/src/link.rs:726:9
|
726 | let arch = match target.architecture {
| ^^^^ help: if this is intentional, prefix it with an underscore: _arch
|
= note: #[warn(unused_variables)] on by default

warning: roc_build (lib) generated 2 warnings
Finished test [unoptimized + debuginfo] target(s) in 0.18s
Running tests/cli_run.rs (target/debug/deps/cli_run-42f9a13667c40034)

running 21 tests
test cli_run::astar ... ok
test cli_run::base64 ... ok
test cli_run::cfold ... ok
test cli_run::cli ... ok
test cli_run::closure ... ok
test cli_run::deriv ... ok
test cli_run::effect ... ok
test cli_run::fib ... ok
test cli_run::hello_rust ... ok
test cli_run::hello_web ... ok
test cli_run::hello_world ... ok
test cli_run::hello_zig ... ok
test cli_run::nqueens ... ok
test cli_run::quicksort ... ok
test cli_run::quicksort_app ... ok
test cli_run::rbtree_ck ... ok
test cli_run::rbtree_insert ... ok
test cli_run::run_multi_dep_str_optimized ... ok
test cli_run::run_multi_dep_str_unoptimized ... ok
test cli_run::run_multi_dep_thunk_optimized ... ok
test cli_run::run_multi_dep_thunk_unoptimized ... ok

test result: ok. 21 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 49.42s


view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 20:28):

Cool. You have a working compiler. The warning messages are due to my quick hacks to disable the -arch

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 20:28):

Still need to figure out what exactly is going on there.

view this post on Zulip Oliver Schöning (Oct 21 2021 at 20:30):

:tada: yay! thanks so much

view this post on Zulip Oliver Schöning (Oct 21 2021 at 20:30):

I can live with this, eventually there will be an installer I assume :D

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:30):

@Brendan Hansknecht those tests don't run sequentially normally

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:31):

it just seems that some machines are more likely to run into that race condition

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:31):

maybe based on processor speed or number of cores

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 20:32):

Oh, i didn't realize. We should maybe at least make the ones in the benchmarks folder run sequentially. Or first compile the host and then use the --precompiled-host flag.

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:33):

that flag exists?

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:33):

if so we can use it, on ci at least

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:34):

because there one of the tests is run to compile the host, effectively pre-compiling it for the rest

view this post on Zulip Brendan Hansknecht (Oct 21 2021 at 20:34):

I added the flag as part of linker changes

view this post on Zulip Folkert de Vries (Oct 21 2021 at 20:34):

oh, excellent

view this post on Zulip Anton (Oct 22 2021 at 08:27):

Thanks for working through this with us @Oliver Schöning ! I have improved the llvm installation instructions for Ubuntu/Debian, I'll also be working on a complete install script today.

view this post on Zulip Oliver Schöning (Oct 22 2021 at 10:35):

@Anton omg no problem! I’m just very grateful for all the help I’ve gotten! Clearly the Elm community spirit also lives in Roc ❤️

view this post on Zulip Luiz de Oliveira (Oct 30 2021 at 19:10):

@Brendan Hansknecht and @Oliver Schöning I think this PR will solve the -arch problem: https://github.com/rtfeldman/roc/pull/1851

Could you guys take a look? @Oliver Schöning this change should make it work smooth.


Last updated: Jul 06 2025 at 12:14 UTC