Stream: beginners

Topic: roc test broken in nixos


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

there seems to be a nixos issue when testing code in a path that differs from the roc compiler directory
https://gist.githubusercontent.com/dankeyy/6497117f3f1550df6340733ed5de74d0/raw/39678d9d8133e11ce149fec6cc005bd93d6b545b/patherr.txt

I guess this is more of a nixos error than roc error? but still perhaps we could come to a solution for it

view this post on Zulip dank (Feb 22 2023 at 07:31):

is it planned for the roc compiler itself to ever statically link with musl?
that would be so convenient

view this post on Zulip Anton (Feb 22 2023 at 08:32):

I think we've talked about it before but I don't remember what we concluded.

view this post on Zulip Anton (Feb 22 2023 at 08:45):

dank said:

there seems to be a nixos issue when testing code in a path that differs from the roc compiler directory
https://gist.githubusercontent.com/dankeyy/6497117f3f1550df6340733ed5de74d0/raw/39678d9d8133e11ce149fec6cc005bd93d6b545b/patherr.txt

I guess this is more of a nixos error than roc error? but still perhaps we could come to a solution for it

Can you make an issue for this to improve the error message?
For now I think we should recommend using nix-build (using the default.nix). For a nicer long-term fix I expect we can patch the binary with the path we set in NIX_GLIBC_PATH but that may not be straightforward.

view this post on Zulip dank (Feb 22 2023 at 08:49):

sure

view this post on Zulip Richard Feldman (Feb 22 2023 at 16:15):

:thinking: is there any reason we shouldn't statically link it with musl?

view this post on Zulip Richard Feldman (Feb 22 2023 at 16:15):

my immediate thought is "yeah let's do it!" but maybe there's a reason not to which I'm missing :big_smile:

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

we should consider a different default allocator then. and probably measure the perf

view this post on Zulip Richard Feldman (Feb 22 2023 at 16:22):

I thought we already switched to a nonstandard one awhile ago

view this post on Zulip Richard Feldman (Feb 22 2023 at 16:22):

could be misremembering

view this post on Zulip Brendan Hansknecht (Feb 22 2023 at 17:18):

We use mimalloc currently

view this post on Zulip Brendan Hansknecht (Feb 22 2023 at 17:18):

Also tested tcmalloc and jemalloc.

view this post on Zulip Brendan Hansknecht (Feb 22 2023 at 17:18):

Tcmalloc was the fastest for me, but Linux only and more of a pain to get working, so mimalloc was chosen in the end.

view this post on Zulip Richard Feldman (Feb 22 2023 at 17:50):

nice! So is there any reason we shouldn't switch to musl on Linux?

view this post on Zulip Brendan Hansknecht (Feb 22 2023 at 18:29):

not that I know of.

view this post on Zulip dank (Feb 22 2023 at 19:01):

I was actually excited about https://github.com/thiagokokada/nix-alien
but it doesn't seem to work on the Roc binary (fails with an exception that originates from ldd's corrupted output)

maybe the roc binary depends on some stuff other than libgcc/glibc (for example who provides __snprintf_chk? one would've guessed glibc, but I have it installed..), I do not know

view this post on Zulip dank (Feb 23 2023 at 12:09):

could be useful to just write up somewhere the total roc dependencies

right now it's kinda confusing at least to me which are roc compiler (as in building roc) dependencies and which are roc binary (dynamic) dependencies

view this post on Zulip dank (Feb 23 2023 at 12:11):

it would also help avoiding issues like the rodio/ alsa dep in the future

view this post on Zulip Richard Feldman (Feb 23 2023 at 13:39):

:thinking: I wonder if we could have CI run ldd on the executable and then if the output isn't exactly what we expect, fail the test - so that you couldn't accidentally introduce a new dynamic dep, you'd have to explicitly change that test

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

I've made #5067 for this


Last updated: Jul 06 2025 at 12:14 UTC