Skip to content
Snippets Groups Projects
Commit cc623933 authored by Dmitry Rodionov's avatar Dmitry Rodionov
Browse files

chore: fix build for centos and astra

The problem lies in nix package which references memfd_create libc symbol 
which doesnt exist in older libc versions available in centos and astra.

The solution is to patch nix to the state of previous version which uses
raw syscall.The offending commit that broke nix for us is:
https://github.com/nix-rust/nix/commit/cf15c2bb5505231bc3128ef61522336e315e2169#diff-17f9119515eead05b2e65afe0b31095ec95425112c31fe3c529a02f46528b970R56

Another instance of the problem in the wild:
https://github.com/lucab/libsystemd-rs/pull/144

The patch uses nix version 26.4 while the latest one is 27 because rustyline
didnt update to 27 yet and keeping two patched versions doesnt make sense.

So this is our fork with the patch: https://git.picodata.io/picodata/picodata/nix/-/tree/fix-memfd-create-for-older-libc-backport-26-4
And upstream PR: https://github.com/nix-rust/nix/pull/2146

In the long run nix doesnt look like a stable option. There is no libc version
compatibility policy at the moment. The way symbols are used makes them
required even if we're not using them. The alternative, rustix uses weak
symbols or falls back to raw syscalls:
https://github.com/bytecodealliance/rustix/blob/b08519f046787b93121214622aac015b68733c8f/src/backend/libc/fs/syscalls.rs#L1631
I believe with this solution we wouldnt have had this problem in the first
place. There is an open issue in rustyline with suggestion to use rustix
instead of nix: https://github.com/kkawakam/rustyline/issues/733
parent ad3d151b
No related branches found
No related tags found
Loading
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment