Hi, On Wed, Apr 17, 2024, at 6:28 AM, Antoine Poinsot wrote: > Good morning all, > > I've been working on using Guix for the reproducible builds of my Rust > software. My main question is about linking my program against an older > glibc version (or better yet, statically linking it against musl). > > [...] > > Now this links against glibc 2.35. I need to target ideally 2.29 or at > most 2.31. That's what i'm seeking help for. I've tried the obvious: > ``` > guix build -f test2.scm --with-input=glibc=glibc@2.29 > ``` >
My knowledge in this area is very shallow, but I also have wanted to link against old glibc versions, for somewhat similar purposes. The best I've got so far is at [1], in which I successfully use `make-gcc-toolchain` to use `gcc` with `glibc-2.31` and define a helper function `package-with-old-stable-libc` to supply it to `package-with-c-toolchain`. I use that in [2] to compile the library I'm interested in against the old glibc version. While this is the best solution I've found so far, I'm still not entirely happy with it! While the code I'm pointing you to isn't too bad, other parts of the overall setup are overly complex (in fairness, largely to also build for Apple platforms), and I haven't managed to build against Glibc 2.23 to fix [3]. But hopefully some of this might be useful, or, better yet, someone might suggest a better solution! Philip [1]: https://github.com/libgit2-racket/native-libs/blob/bd400daed8d4e38db6fc472d4ec82b99a884303c/guix/old-stable-libc.scm [2]: https://github.com/libgit2-racket/native-libs/blob/bd400daed8d4e38db6fc472d4ec82b99a884303c/guix/extracted/non-apple.scm [3]: https://github.com/libgit2-racket/libgit2/issues/2