Stream: contributing

Topic: what good first issues do you prioritize


view this post on Zulip dank (Feb 03 2023 at 12:20):

Done first issue! I want to help out some more, which of the current issues do you prefer be taken care of?

view this post on Zulip Anton (Feb 03 2023 at 12:47):

Super cool :)
Can you look into the musl target issue with macos from PR#4980. So we want the target to be x86_64-unknown-linux-musl on linux x86_64, aarch64-unknown-linux-musl on linux aarch64 and to not change the target in other situations (windows, macos...)

view this post on Zulip Richard Feldman (Feb 03 2023 at 14:00):

as I recall, macOS has a policy that you're always supposed to dynamically link libSystem for its libc

view this post on Zulip Richard Feldman (Feb 03 2023 at 14:01):

so I think we should probably never try to build with musl on macOS :big_smile:

view this post on Zulip dank (Feb 03 2023 at 14:09):

yea ill only update linux

um how do you if at all test platforms without an application?
if you try to cargo build basic_cli you get https://gist.githubusercontent.com/dankeyy/9f0134bdd98a043c37d8fd7ca75cd68f/raw/2cd7503967f64c4d2b86741e5ee7feca6a5ad73b/basic_cli%2520error

view this post on Zulip Anton (Feb 03 2023 at 14:19):

In basic-cli/src/Cargo.toml, it is specified that our rust program links the app lib, which is produced by roc, so I just do ./roc_nightly/roc build ../basic-cli/examples/countdown.roc. I'm not sure if there is some workaround to be able to test platforms in a standalone manner...

view this post on Zulip Anton (Feb 03 2023 at 14:20):

I've done basically no platform development

view this post on Zulip Folkert de Vries (Feb 03 2023 at 14:23):

cargo test should work

view this post on Zulip Folkert de Vries (Feb 03 2023 at 14:24):

cargo build does not work because the code depends on symbols that roc needs to provide

view this post on Zulip Folkert de Vries (Feb 03 2023 at 14:24):

but you can run tests so long as they don't use these roc symbols

view this post on Zulip Folkert de Vries (Feb 03 2023 at 14:24):

I'd think cargo check would also work

view this post on Zulip dank (Feb 03 2023 at 14:29):

Folkert de Vries said:

cargo build does not work because the code depends on symbols that roc needs to provide

yea ik but I just wanted a way to quickly get an object file that I could check if it targeted correctly

view this post on Zulip Folkert de Vries (Feb 03 2023 at 14:37):

you can actually find the target in the error message you posted

view this post on Zulip dank (Feb 03 2023 at 14:52):

oh lmao I didn't even notice

view this post on Zulip dank (Feb 03 2023 at 16:49):

so I did some digging
here's what we cant do:

  1. print a cargo:target according to cfg data in build.rs - that feature apparently does not exist
  2. the rust-toolchain.toml + .config/cargo.toml combo - you can specify multiple targets in both of them, but it isn't conditional. you cant dynamically select one based on current os (it just attempts to build them all lol).

what we can do is kinda meh but it's setting the environment flag CARGO_BUILD_TARGET

somebody even suggested me execing the right cargo commands in build.rs lol

view this post on Zulip Anton (Feb 03 2023 at 17:19):

I think we can do something similar to 1: put println!("cargo:rustc-flags=--target=x86_64-unknown-linux-musl"); in a build.rs with a cfg for os and architecture.

view this post on Zulip dank (Feb 03 2023 at 17:30):

that would get you error: Only -l and -L flags are allowed in build script

view this post on Zulip Anton (Feb 03 2023 at 17:48):

Too bad...
Can we set CARGO_BUILD_TARGET in the build.rs?

view this post on Zulip dank (Feb 03 2023 at 18:08):

Anton said:

Too bad...
Can we set CARGO_BUILD_TARGET in the build.rs?

lol I just now was trying it
I thought so but it doesn't seem to stick

view this post on Zulip dank (Feb 03 2023 at 18:10):

ahhh it's running in a subshell

view this post on Zulip dank (Feb 03 2023 at 19:31):

https://gist.github.com/dankeyy/80fcc9c5d430b865cb89ddab896d83e1
So hacky, but something like this should work. this is a trick rusters (rusteceans?) use to bypass the fact that build.rs runs in a subshell haha
Although on the link error I still see gnu. Haven't figured out why yet but that general direction should work

view this post on Zulip dank (Feb 03 2023 at 19:32):

@Anton

view this post on Zulip Anton (Feb 04 2023 at 09:06):

Thanks @dank, it looks acceptably hacky :p

view this post on Zulip Anton (Feb 04 2023 at 09:17):

What do you get with ./roc_nightly/roc build ./examples/countdown.roc? In src/target you should see a folder named x86_64-unknown-linux-musl if it actually used that target

view this post on Zulip dank (Feb 04 2023 at 11:32):

Anton said:

What do you get with ./roc_nightly/roc build ./examples/countdown.roc? In src/target you should see a folder named x86_64-unknown-linux-musl if it actually used that target

I do actually see that folder so that's good
(btw basic_cli can cargo build now)
but when I look at ldd countdown it seems like it still links with glibc

view this post on Zulip dank (Feb 04 2023 at 11:36):

these are the changes and what came out if you wanna have a look too https://github.com/dankeyy/basic-cli/tree/custom_targets

view this post on Zulip dank (Feb 04 2023 at 11:41):

(I'll gitignore it later but) these look weird
https://github.com/roc-lang/basic-cli/commit/62e4af678f609e103eb4b58b62d9e2f1d283c1e2#diff-6350355364e65408a16e43505e743340cc1c16b136695be77ee0f12ac6fd7a1a

https://github.com/roc-lang/basic-cli/commit/62e4af678f609e103eb4b58b62d9e2f1d283c1e2#diff-03f3294caf9996fe87de1bfdd59548fe7ad796d658b0e63681410044a826632d

view this post on Zulip dank (Feb 04 2023 at 11:41):

dropping unsupported crate type cdylib for target x86_64-unknown-linux-musl

view this post on Zulip Anton (Feb 04 2023 at 11:54):

I've found that "rustc for musl does not support dynamic linking" from here. I'm going to look into it more after lunch

view this post on Zulip dank (Feb 04 2023 at 11:56):

damn

view this post on Zulip Anton (Feb 04 2023 at 12:55):

We had it working earlier when always setting x86_64-unknown-linux-musl with .cargo/config so I'd expect we can solve this.

view this post on Zulip Anton (Feb 04 2023 at 13:02):

Can you try without this line?

view this post on Zulip dank (Feb 04 2023 at 13:11):

still glibc

view this post on Zulip dank (Feb 04 2023 at 13:19):

Anton said:

I've found that "rustc for musl does not support dynamic linking" from here. I'm going to look into it more after lunch

even setting the flags like the comment below suggests doesnt seem to effect anything

view this post on Zulip dank (Feb 04 2023 at 13:26):

i may have an idea as to what's going on. hold up

view this post on Zulip dank (Feb 04 2023 at 13:30):

ok I think it was a confusement of roc build on the target path
deleting the custom target_dir arg, it hangs
ill see what i can do

view this post on Zulip dank (Feb 04 2023 at 17:05):

Well bad news.
The hacky approach doesnt seem to effect the build outcome (really not sure why)

Neither does messing with RUST_FLAGS (from within the build script)
and unfortunately neither does this trick I was hopeful for // println!("cargo:rustc-env=CARGO_BUILD_TARGET={}-unknown-linux-musl", std::env::consts::ARCH);

Worst case scenario we could actually just do it from outside the various rust configs, yea? it's just kinda sucky

Maybe I'll come up with something clever later, but for now kinda blocked ¯\_(ツ)_/¯

view this post on Zulip Anton (Feb 04 2023 at 17:57):

I've thought of something, we can create or write to an existing .cargo/config file for the CI workflow where the files (.rh1, .o) for linux are generated. Because we only do it in that step, there would be no issues on macos etc. .

view this post on Zulip dank (Feb 04 2023 at 18:16):

yea I've thought of that. but at this point, wouldn't it be easier to just set the env var?

view this post on Zulip dank (Feb 04 2023 at 18:16):

(it should work if we're doing it externally, the only problem in previous approach was that it ran in a subshell)

view this post on Zulip Anton (Feb 04 2023 at 18:21):

I know we clear all env vars at some points for better reproducibility, can you check if setting the env var works?
It is indeed the easier solution :)

view this post on Zulip dank (Feb 04 2023 at 18:48):

Anton said:

I know we clear all env vars at some points for better reproducibility, can you check if setting the env var works?
It is indeed the easier solution :)

yea yea. I ran it before to make sure it's a only the subshell's fault that it's still linking with glibc..
it works great

[dankey@computer:~/dev/basic-cli/src]$ CARGO_BUILD_TARGET=x86_64-unknown-linux-musl ~/dev/roc/target/debug/roc build ~/dev/basic-cli/examples/countdown.roc && ldd /home/dankey/dev/basic-cli/examples/countdown
🔨 Rebuilding platform...
0 errors and 0 warnings found in 1532 ms while successfully building:

    /home/dankey/dev/basic-cli/examples/countdown
        statically linked

view this post on Zulip Anton (Feb 05 2023 at 08:48):

Excellent, I'll do a new release of basic-cli on Monday. Thanks for all the help @dank!

view this post on Zulip Anton (Feb 06 2023 at 19:07):

I wanted to add some extra testing for the basic-cli release and ended up spending a long time on some refactoring. I should be able to release tomorrow though.

view this post on Zulip dank (Feb 08 2023 at 21:13):

What's up Anton?
I gather something didnt work?

view this post on Zulip dank (Feb 08 2023 at 21:15):

btw is someone working on the editor right now? i saw a couple todos which might be doable for me

view this post on Zulip Luke Boswell (Feb 08 2023 at 22:27):

My understanding is that editor development has been on hold for a little while, the focus has been smashing bugs and adding core features/stability I think. @Anton mentioned a refactor of the editor is planned to start soon, this half of 2023. I started looking at the Breakout example to learn more and prepare for editor dev, then switched to making my own platform roc-tui but haven't made much progress recently. I think glue is being upgraded to use a .roc plugin for code generation and also to support a new way of doing effects without the hosted module type. This will be necessary for building more complicated platforms, and should enable more host languages to be supportable by glue. I am not sure how progress is on this, if anyone has an update that would be super. :grinning:

view this post on Zulip Ayaz Hafiz (Feb 08 2023 at 22:54):

Anton is on holiday for a few days. And yeah, active development editor has been on hold; the priority for now is stabilizing the language and pushing along glue and effects.

view this post on Zulip Ayaz Hafiz (Feb 08 2023 at 22:55):

Having glue work with Roc plugins is currently ongoing. Besides that, a big effort is getting glue to work with generating bindings for closures, which Folkert is working on.

view this post on Zulip dank (Feb 09 2023 at 17:51):

Ayaz Hafiz said:

Anton is on holiday for a few days. And yeah, active development editor has been on hold; the priority for now is stabilizing the language and pushing along glue and effects.

any pressing good first issues in these areas?

view this post on Zulip Luke Boswell (Feb 09 2023 at 22:08):

@dank I'm not as qualified as most people here. But I think something that I would personally find very helpful is if you were able to write some of the documentation for Abilities language feature.

At the moment I understand there are a number of Abilities implemented, esp Eq Hash Encode Decode etc, but there is really limited documentation, especially for making your own custom ones.

Note that I think there was some discussion about changing the syntax a bit because we don't love the current implementation, I will try and dig out that discussion and link here.

You can find information scattered through various tests, merged PRs, and some discussion on Zulip here. But consolidating that into some notes would be super helpful.

I've had a few goes at using abilities and found some bugs. I've not made much progress playing with them as it is difficult for me to separate my lack of understanding and incomplete feature sometimes.

There is a section waiting to be written in the tutorial using markdown at;

www/generate_tutorial/src/input/tutorial.md

And also the documentation comments for the builtins are missing at

crates/compiler/builtins/roc/Encode.roc and crates/compiler/builtins/roc/Decode.roc

view this post on Zulip Luke Boswell (Feb 09 2023 at 22:10):

Note there is a design doc in the repo at design/language/Abilities.md

view this post on Zulip Luke Boswell (Feb 09 2023 at 22:12):

Tracking PR

view this post on Zulip Luke Boswell (Feb 09 2023 at 22:27):

Zulip abilities

Zulip abilities syntax

view this post on Zulip Luke Boswell (Feb 10 2023 at 00:50):

Another idea for anyone to consider. It's writing Roc code, so not really compiler stuff which I think your looking for @dank; but if anyone is interested we could write more parsers, tests and examples.

We've got a parser package at examples/parser/package/main.roc and examples at examples/parser/examples.

I started with a plan to write smaller examples to show how to write/use parsers in Roc, and also add more tests, but haven't touched it in a few weeks.

view this post on Zulip Ayaz Hafiz (Feb 10 2023 at 03:02):

what kind of things are you interested in? if you are interested in type systems and/or compilation (lowering source languages) feel free to DM me; less good first issues there, but we’d love to figure out a project you might like and ramp up!!

view this post on Zulip Anton (Feb 11 2023 at 15:11):

@dank sorry, I should have communicated my progress. I'm now ironing out the last bugs on the automated testing of the release. The combination of bash and multiple CI servers makes for a slow feedback loop, but I expect to be done on monday.

view this post on Zulip dank (Feb 11 2023 at 15:49):

Ayaz Hafiz said:

what kind of things are you interested in? if you are interested in type systems and/or compilation (lowering source languages) feel free to DM me; less good first issues there, but we’d love to figure out a project you might like and ramp up!!

thanks. im mostly interested in backend stuff like code gen and optimizations.
i'll finish some unrelated stuff and dm you soon, thanks!!

view this post on Zulip dank (Feb 11 2023 at 15:50):

Anton said:

dank sorry, I should have communicated my progress. I'm now ironing out the last bugs on the automated testing of the release. The combination of bash and multiple CI servers makes for a slow feedback loop, but I expect to be done on monday.

oh no worries! glad it's going ok :+1:

view this post on Zulip Anton (Feb 11 2023 at 18:53):

I've made the 0.2.1 pre-release for basic-cli. I've tested it and it works on NixOS :tada:. I'm really glad we got this done, thank you so much for your help @dank!

Note that it's currently using tar.gz instead of tar.br, I'll update it to tar.br on Monday.

view this post on Zulip dank (Feb 11 2023 at 19:06):

Anton I think we've got a small issue though. Are you sure url download works on your nixos?

❯ ldd ~/.cache/roc/packages/github.com/roc-lang/basic-cli/releases/download/0.2.1/Ja9E41aYCiBElYvaSIGl7RY8_kQcdtwApHUcCnt-YDQ/linux-x86_64.rh1
        ldd (0x7f4f5519d000)

~/testing/roctests
❯ file ~/.cache/roc/packages/github.com/roc-lang/basic-cli/releases/download/0.2.1/Ja9E41aYCiBElYvaSIGl7RY8_kQcdtwApHUcCnt-YDQ/linux-x86_64.rh1
/home/dankey/.cache/roc/packages/github.com/roc-lang/basic-cli/releases/download/0.2.1/Ja9E41aYCiBElYvaSIGl7RY8_kQcdtwApHUcCnt-YDQ/linux-x86_64.rh1: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=1ebcd9d14b2c1a1840a12d240ae2a4fbb3624133, with debug_info, not stripped

It's a static-pie
So "statically linked" won't show in ldd rh1
So it will trigger an error on nixOS

view this post on Zulip Anton (Feb 11 2023 at 19:11):

Oh I see. Yes it did work on NixOS, I don't know yet why the error was not triggered...

view this post on Zulip dank (Feb 11 2023 at 19:13):

it does trigger on my machine actually

view this post on Zulip dank (Feb 11 2023 at 19:25):

but ofc no reason static-pie wouldnt work (and it does)
so it's a pretty easy fix @Anton
if you'd want I can pr a fix to account for static-pie real quick

view this post on Zulip dank (Feb 11 2023 at 19:27):

This can be done by either querying ldd for (not)"=>" or "ldd".
Or even moving as a whole to using file instead (tho that's probably not ideal bc then you need to actually regex it in case the path contains "static" haha).
whichever you prefer

view this post on Zulip Anton (Feb 12 2023 at 08:23):

querying ldd for (not)"=>" or "ldd".

Sounds good :)

view this post on Zulip Anton (Feb 13 2023 at 14:49):

I've uploaded the new tar.br to the basic-cli release assets

view this post on Zulip dank (Feb 13 2023 at 18:21):

So now everything works out of the box in NixOS

❯ ~/dev/roc/target/release/roc dev
Downloading https://github.com/roc-lang/basic-cli/releases/download/0.2.1/wx1N6qhU3kKva-4YqsVJde3fho34NqiLD3m620zZ-OI.tar.br
    into /home/dankey/.cache/roc/packages

hellooo

that's so cool

view this post on Zulip Richard Feldman (Feb 13 2023 at 19:44):

WOOOO!!!!! :tada: :tada: :tada:

view this post on Zulip Richard Feldman (Feb 13 2023 at 19:44):

amazing job getting that working!

view this post on Zulip Richard Feldman (Feb 13 2023 at 20:00):

that's fantastic - so now we have a template that future Roc platforms with Rust hosts can use for how to Just Work across Linux distros, even Nix! :smiley:

view this post on Zulip Richard Feldman (Feb 24 2023 at 17:45):

oh also it means we can drop this note in the tutorial now :big_smile:

Screen-Shot-2023-02-24-at-12.44.19-PM.png

view this post on Zulip Anton (Feb 24 2023 at 18:06):

Yeah, I have had a PR up for it for some time but I'm still encountering a difficult to debug CI issue

view this post on Zulip Richard Feldman (Feb 24 2023 at 18:21):

oh weird


Last updated: Jul 06 2025 at 12:14 UTC