Stream: ideas

Topic: Faster builds and reproducible development environment


view this post on Zulip Locria Cyber (Nov 04 2021 at 03:33):

So, I tried out guix. It uses its custom programming language (and I can't find documentation for it), and even the hash format of a file is special (its "base32" isn't compatible with base32 from GNU coreutils, despite bith made by GNU)! This is madness.

view this post on Zulip Locria Cyber (Nov 04 2021 at 03:36):

I guess Vagrant is still the best solution right now.

view this post on Zulip Locria Cyber (Nov 04 2021 at 05:37):

So, the editor requires https://crates.io/alsa-sys

view this post on Zulip Locria Cyber (Nov 04 2021 at 05:37):

It certainly doesn't need it

view this post on Zulip Locria Cyber (Nov 04 2021 at 05:51):

Full build:

________________________________________________________
Executed in   86.72 secs    fish           external
   usr time   75.74 secs    1.95 millis   75.74 secs
   sys time   11.47 secs    2.48 millis   11.47 secs

fish: Job 1, 'time mold -run cargo run --targ…' terminated by signal SIGILL (Illegal instruction)

view this post on Zulip Locria Cyber (Nov 04 2021 at 05:52):

Incremental build: (change one string in cli/src/main.rs

> time mold -run cargo run --target-dir ~/.cache/roc -- ../examples/hello-world/Hello.roc
   Compiling roc_gen_llvm v0.1.0 (/home/vagrant/roc/compiler/gen_llvm)
   Compiling roc_build v0.1.0 (/home/vagrant/roc/compiler/build)
   Compiling roc_linker v0.1.0 (/home/vagrant/roc/linker)
   Compiling roc_cli v0.1.0 (/home/vagrant/roc/cli)
    Finished dev [unoptimized + debuginfo] target(s) in 15.64s
     Running `/home/vagrant/.cache/roc/debug/roc ../examples/hello-world/Hello.roc`

________________________________________________________
Executed in   16.16 secs    fish           external
   usr time    3.78 secs    0.81 millis    3.78 secs
   sys time    1.59 secs    1.03 millis    1.58 secs

fish: Job 1, 'time mold -run cargo run --targ…' terminated by signal SIGILL (Illegal instruction)

view this post on Zulip Locria Cyber (Nov 04 2021 at 05:53):

One more try:

> time cargo run --target-dir ~/.cache/roc -- ../examples/hello-world/Hello.roc
   Compiling roc_gen_llvm v0.1.0 (/home/vagrant/roc/compiler/gen_llvm)
   Compiling roc_build v0.1.0 (/home/vagrant/roc/compiler/build)
   Compiling roc_linker v0.1.0 (/home/vagrant/roc/linker)
   Compiling roc_cli v0.1.0 (/home/vagrant/roc/cli)
    Finished dev [unoptimized + debuginfo] target(s) in 14.02s
     Running `/home/vagrant/.cache/roc/debug/roc ../examples/hello-world/Hello.roc`

________________________________________________________
Executed in   14.44 secs    fish           external
   usr time    3.38 secs  556.00 micros    3.38 secs
   sys time    1.54 secs  749.00 micros    1.54 secs

fish: Job 1, 'time cargo run --target-dir ~/.…' terminated by signal SIGILL (Illegal instruction)

view this post on Zulip Locria Cyber (Nov 04 2021 at 05:57):

Note the SIGILL

view this post on Zulip Locria Cyber (Nov 04 2021 at 05:58):

To reproduce the error, switch to vagrant git branch and run:

vagrant up
vagrant ssh
# now in ssh
cd /home/vagrant/roc/cli
cargo run --target-dir ~/.cache/roc -- ../examples/hello-world/Hello.roc # --target-dir because hard link

view this post on Zulip Locria Cyber (Nov 08 2021 at 12:39):

We need a reproducible build environment!
I tried vagrant and...

  1. virtualbox backend uses too much memory and CPU
  2. libvirt backend has too small tmpfs

view this post on Zulip Locria Cyber (Nov 08 2021 at 12:39):

vagrant box with libvirt backend:

vagrant@archlinux ~> df
Filesystem                                     1K-blocks      Used Available Use% Mounted on
dev                                               221556         0    221556   0% /dev
run                                               239816       524    239292   1% /run
/dev/vda2                                       20969452   2298996  18524812  12% /
tmpfs                                             239816         0    239816   0% /dev/shm
tmpfs                                             239816    238224      1592 100% /tmp

note that /tmp is full

view this post on Zulip Locria Cyber (Nov 08 2021 at 12:40):

pain

view this post on Zulip Locria Cyber (Nov 08 2021 at 12:40):

Probably docker is the only sane choice now

view this post on Zulip Richard Feldman (Nov 08 2021 at 12:40):

I think Nix is the best option.

view this post on Zulip Richard Feldman (Nov 08 2021 at 12:41):

Docker uses too many system resources in non-Linux environments

view this post on Zulip Lucas Rosa (Nov 08 2021 at 14:31):

nix really is the best option here. Vagrant was essentially replaced by docker and docker has gotten weird lately with their business model. Also docker runs on Rosetta on M1 Macs :’(

view this post on Zulip Lucas Rosa (Nov 08 2021 at 14:32):

earthly does use docker on the hood tho, so we kinda already has docker working for testing stuff but via earthly

view this post on Zulip Richard Feldman (Nov 08 2021 at 14:37):

yeah Earthly has the downside of only running on Linux images though, which means we can only use it for Linux CI at most, so we need to find something else for Mac and (someday) Windows CI regardless :big_smile:

view this post on Zulip Lucas Rosa (Nov 08 2021 at 16:38):

yea true, I noticed the other day when I had some trouble running the earthly tests

view this post on Zulip Takeshi Sato (Nov 09 2021 at 15:10):

Docker is a greedy consumer of my laptop battery...
Nevertheless, I prefer it to nix for now mainly because I cannot parse nix's config syntax yet.
Docker is easy to use but hard for machine.
I am wondring which tools I should select in nix ecosystem, such as niv or flake etc.

view this post on Zulip Brendan Hansknecht (Nov 09 2021 at 16:55):

Nix definitely takes a bit of getting used to, but it generally is quite nice once learned. I say generally because edge cases can be really painful and annoying, but they are becoming less and less common.
As for niv vs flakes, I know that we use niv. Maybe the person who chose it can comment and give a reason why.

view this post on Zulip Brendan Hansknecht (Nov 09 2021 at 16:57):

I think that was @Anton

view this post on Zulip Brian Hicks (Nov 09 2021 at 18:03):

I think it was me, actually! Basically: we use Niv because it makes updating hashes for stuff a lot easier while not requiring experimental Nix features. Flakes are definitely where everything is going over time but they're not released in a stable form yet.

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:39):

Richard Feldman said:

I think Nix is the best option.

Nix behaves well, but is hard to learn

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:40):

I'd agree with that, which I think makes it the best fit for this use case

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:40):

Nix doesn't have virtualization

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:40):

most people won't need to learn it!

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:41):

:thinking: why would virtualization be desirable for building the compiler?

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:41):

But it doesn't work last time I checked it

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:41):

It's not desirable. Reproducible build environment is.

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:41):

There's like firejail for isolation

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:41):

agreed

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:42):

we don't have a working Nix build yet, but that's a separate question from what's the best goal to work toward

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:42):

among the options, Nix seems like the best goal to aim for

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:42):

So when will the problem be fixed?

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:42):

https://roc.zulipchat.com/#narrow/stream/231634-beginners/topic/.E2.9C.94.20Nix

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:43):

I can't build Roc because of random Nix package regression and have no idea how it fix it

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:44):

can you build using the manual installation instructions in BUILDING_FROM_SOURCE.md?

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:46):

I've installed a lot of weird stuff on my system, like mold and zig 0.9

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:47):

I don't think having mold installed should affect a normal checkout, since nothing in the roc code base references it as far as I know

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:47):

as for Zig, I think as long as you have the right version on your PATH it should be fine if there's another version installed somewhere else on the system

view this post on Zulip Locria Cyber (Nov 10 2021 at 01:47):

How do you set crate-local linker?

view this post on Zulip Richard Feldman (Nov 10 2021 at 01:49):

I don't know, but I don't think that should be necessary to build roc

view this post on Zulip Brendan Hansknecht (Nov 10 2021 at 06:09):

Richard Feldman said:

we don't have a working Nix build yet, but that's a separate question from what's the best goal to work toward

We don't have an 100% working nix build, but we definitely have a working nix build. I having been using it on both my linux and M1 mac machine. On my linux machine, cargo build and cargo test run just fine even inside of a pure shell. There definitely can be some issues with the editor, but I would say that our nix build is mostly working.

view this post on Zulip Takeshi Sato (Nov 10 2021 at 11:05):

Thank you, folks. I will retry nix with niv. I hope that I will like docker as well as nix.


Last updated: Jun 16 2026 at 16:19 UTC