Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully static build by default #51

Open
matklad opened this issue Jun 3, 2024 · 3 comments
Open

Fully static build by default #51

matklad opened this issue Jun 3, 2024 · 3 comments

Comments

@matklad
Copy link
Contributor

matklad commented Jun 3, 2024

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
Copy link
Member

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
Copy link
Contributor Author

matklad commented Jun 3, 2024

🤯

@kylewlacy
Copy link
Member

Following the v0.1.4 release, Brioche's packed builds should work on NixOS, Alpine Linux, and any other distros that don't use glibc! The packed builds work exactly as described above: they're builds of Brioche built with Brioche itself, so they're fully portable.

Currently, the default is still to use the glibc-based builds, but the installer script will now try and detect if it's running on a system without glibc, and will automatically install packed build instead (see brioche-dev/brioche.dev#12 for more context).

I'd still like to make packed builds the default longer-term, so I'm not closing this issue out quite yet. The remaining work is to support automatic updates for packed builds and to figure out how to migrate existing installations over.

Also, I've only manually tested in Alpine via Docker, so I'd appreciate feedback if anyone tries out Brioche on an actual Alpine machine, or on NixOS or other distros that don't use glibc or the FHS!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants