Skip to content

Fix various packages to build with mlibc #426772

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

Draft
wants to merge 14 commits into
base: staging
Choose a base branch
from

Conversation

siraben
Copy link
Member

@siraben siraben commented Jul 19, 2025

Things done

Depends on #371092. Begin fixing builds on various packages built with mlibc. I'm not sure if this is the best pattern to use. cc @lzcunt

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and others READMEs.

Add a 👍 reaction to pull requests you find important.

@siraben siraben changed the title Mlibc fixes Fix various packages to build with mlibc Jul 19, 2025
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: lib The Nixpkgs function library labels Jul 19, 2025
lzcunt and others added 14 commits July 19, 2025 18:37
Previously gccWithoutTargetLibc was built with `langCC = false;`, which
meant stdenvNoLibc had C++ support when not cross compiling or when the
host platform toolchain is LLVM, but did not have C++ support when cross
compiling for a non-Darwin and non-LLVM host platform. This patch
enables langCC in gccWithoutTargetLibc for mlibc platforms, because
mlibc is written in C++. Sadly enabling this for musl doesn't work so
I've left a FIXME for someone else to look into it.

This patch also runs autoreconf for gccWithoutTargetLibc, which is
necessary to make libstdcxx disable link tests (which cannot be run
without a libc).

Co-Authored-By: Artturin <[email protected]>
Co-Authored-By: Arsen Arsenović <[email protected]>
Checking if openssl is a derivation requires evaluating stdenv.cc, which
depends on mlibc when cross compiling to a mlibc platform, which depends
on meson, which depends on Python.

See previous commit 0070883 on why the recursion break happens in the
Python expression.
In gcc, libsanitizer is disabled because mlibc doesn't support
libsanitizer yet but upstream is working on it. Patches needed for gcc to
support linux-mlibc targets are pulled from managarm's fork of gcc,
patches only needed by managarm are not applied.

Also includes some refactoring around the `--disable-libsanitizer`
configure flag.
It's only glibc with a quirk that makes it bad at static linking. mlibc,
LLVM libc, and others are just fine with static linking.
This hack was removed recently. The comment doesn't describe anything
useful now.
@siraben siraben changed the base branch from master to staging July 20, 2025 01:38
@nixpkgs-ci nixpkgs-ci bot closed this Jul 20, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this Jul 20, 2025
@lzcunt
Copy link
Member

lzcunt commented Jul 20, 2025

For most tests, I'd rather fix what makes them not pass then disable tests (except when absolutely necessary)

@siraben
Copy link
Member Author

siraben commented Jul 20, 2025

Alright, I'll go through the ones that disable tests due to mlibc and revert those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: lib The Nixpkgs function library 6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants