brioche-dev / brioche

A delicious package manager
https://brioche.dev
MIT License
348 stars 5 forks source link

Fully static build by default #51

Open matklad opened 5 months ago

matklad commented 5 months ago

Trying out brioche on NixOS gives the expected result:

λ ~/.local/bin/brioche 
Could not start dynamically linked executable: /home/matklad/.local/bin/brioche
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
λ ldd ~/.local/bin/brioche
    linux-vdso.so.1 (0x00007ffd7b584000)
    libc.so.6 => /nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib/libc.so.6 (0x00007f805a413000)
    /lib64/ld-linux-x86-64.so.2 => /nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib64/ld-linux-x86-64.so.2 (0x00007f805fa59000)
    liblzma.so.5 => not found
    libgcc_s.so.1 => /nix/store/1q9vc0lq7qjlfjz47mfmlzdf86c543jy-xgcc-13.2.0-libgcc/lib/libgcc_s.so.1 (0x00007f805fa32000)
    libm.so.6 => /nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib/libm.so.6 (0x00007f805a330000)

For the kind of tool brioche is, it seems that providing a fully statically-liked executable might be beneficial?

kylewlacy commented 5 months ago

Definitely interested in providing this sooner rather than later! It wouldn't be as easy as cargo build --target=x86_64-unknown-linux-musl because (at least last time I looked), the V8 crate used by deno_core doesn't support Musl.

..so one kinda interesting option would be to build Brioche normally in CI as a "stage 1" build, then to use Brioche itself to build Brioche as "stage 2", which would then be a self-contained package. I'll try to get an idea of how much effort that is to set up soon, to see if I could get it in as part of the next point release

matklad commented 5 months ago

:exploding_head: