Skip to content

libiconvReal: make default on Darwin#511070

Open
reckenrode wants to merge 5 commits intoNixOS:stagingfrom
reckenrode:push-zrltqnunnoww
Open

libiconvReal: make default on Darwin#511070
reckenrode wants to merge 5 commits intoNixOS:stagingfrom
reckenrode:push-zrltqnunnoww

Conversation

@reckenrode
Copy link
Copy Markdown
Contributor

@reckenrode reckenrode commented Apr 18, 2026

The Darwin libiconv tries to be compatible with GNU libiconv, but it’s not. Recent versions of Autoconf and gnulib include checks for issues in Darwin’s libiconv implementation, which has effectively turned autoreconfHook into autoBreakDarwinHook due to failing to link libiconv. Instead of continuing to work around it, make GNU libiconv the default. With the UTF-8-MAC patch, it should be a drop-in replacement.

Things done

  • 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 other READMEs.

@reckenrode
Copy link
Copy Markdown
Contributor Author

Oh, right. I forgot to split the stdenv changes out for this PR. I’ve added them to the last commit making GNU libiconv the default.

@ofborg ofborg Bot added the 6.topic: darwin Running or building packages on Darwin label Apr 18, 2026
@reckenrode reckenrode force-pushed the push-zrltqnunnoww branch 2 times, most recently from 3ff1260 to 9d7c94d Compare April 18, 2026 04:39
@reckenrode
Copy link
Copy Markdown
Contributor Author

I fixed the eval error in pkgsStatic and rebasing on current staging.

@reckenrode reckenrode changed the title libiconv: make default on Darwin libiconvReal: make default on Darwin Apr 18, 2026
@nixpkgs-ci nixpkgs-ci Bot requested review from a team, DimitarNestorov, adevress, balsoft, bjornfor, fpletz, kashw2, me-and, philiptaron, prusnak, thiagokokada, thoughtpolice, wmertens and zivarah and removed request for a team April 18, 2026 04:57
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 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. labels Apr 18, 2026
@reckenrode
Copy link
Copy Markdown
Contributor Author

I see that this was added to the Nixpkgs security review board. Another argument for using GNU libiconv over Apple’s libiconv is is that fixes for any vulnerabilities or issues found in the latter will only become available once Apple does a new code drop, which typically happens a few weeks to a month after the OS update is released.

@reckenrode
Copy link
Copy Markdown
Contributor Author

Linking Homebrew and MacPorts discussions here. There are more links in the discussions as well.

These issues don’t affect us for a few reasons:

  1. Our build of GNU libiconv takes steps to present a compatible ABI with the system one;
  2. We delete all libiconv headers and stubs from the SDK. There is no way to mix them accidentally; and
  3. The libiconv issue with GHC/stack has a fix applied because we want to use libiconv from Nixpkgs regardless.

@reckenrode
Copy link
Copy Markdown
Contributor Author

In terms of testing, I’m using the following command. The only failure I have is nodejs-slim, which appears to be unrelated. It’s having issues with OpenSSL 3.6 and some other things. Previously known problematic builds like Git and libarchive, which failed due to requiring the UTF-8-MAC codec, build fine.

$ nix build -f . darwin.{AvailabilityVersions,DarwinTools,ICU,IOKitTools,adv_cmds,basic_cmds,binutils,binutils-unwrapped,binutilsDualAs,binutilsDualAs-unwrapped,binutilsNoLibc,bootstrap_cmds,copyfile,developer_cmds,diskdev_cmds,doc_cmds,dyld,file_cmds,libcxx,libffi,libiconv,libpcap,libresolv,libsbuf,libunwind,libutil,locale,lsusb,mail_cmds,misc_cmds,network_cmds,patch_cmds,ps,remote_cmds,removefile,shell_cmds,signingUtils,sigtool,system_cmds,text_cmds,top,trash,xattr} libunistring man-db dotnet-sdk_10 vulkan-caps-viewer mpv

@reckenrode reckenrode force-pushed the push-zrltqnunnoww branch 2 times, most recently from 6e99929 to 0fa3bce Compare April 19, 2026 10:59
@balsoft balsoft moved this from Needs Review to In Review in Nixpkgs security review Apr 19, 2026
@balsoft

This comment was marked as resolved.

@balsoft balsoft moved this from In Review to Reviewed in Nixpkgs security review Apr 19, 2026
Copy link
Copy Markdown
Member

@Eveeifyeve Eveeifyeve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no issues with this from diff and homebrew/macports concerns mentioned to have this change be merged. The nodejs-slim issue is related to openssl which should be fixed in a completely different pr IMO.

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Apr 19, 2026
@balsoft balsoft moved this from Reviewed to In Review in Nixpkgs security review Apr 19, 2026
@reckenrode
Copy link
Copy Markdown
Contributor Author

My pushes have been rebasing the PR on current staging.

@reckenrode reckenrode force-pushed the push-zrltqnunnoww branch 2 times, most recently from c532be4 to d620df1 Compare April 19, 2026 19:46
@reckenrode
Copy link
Copy Markdown
Contributor Author

reckenrode commented Apr 19, 2026

There appears to be a (trivial) diff between the patch source and the vendored patch:

I changed it to use fetchurl. If I’m going to be setting patchFlags to -p0 anyway, then I might as well do that. The original reason for vendoring was that I can’t use fetchpatch2 (e.g., with extraPrefix) because it causes an infinite recursion in the Darwin stdenv bootstrap.

@reckenrode
Copy link
Copy Markdown
Contributor Author

reckenrode commented Apr 19, 2026

Once @emilazy weighs in, and she approves, I’ll merge and give #511329 a heads up.

@reckenrode
Copy link
Copy Markdown
Contributor Author

reckenrode commented Apr 21, 2026

The nodejs-slim issue is related to openssl which should be fixed in a completely different pr IMO.

I agree the nodejs-slim issues should be addressed in another PR. I was noting that problem because it the only thing in my testing that failed to build. The OpenSSL problem (fixed in #510554) is not the only one though. I ended up also having to disable the following tests. I’m not opening a PR for that because I don’t know whether it’s the right fix. My goal was only getting to the point I can build .NET and mpv.

"test-esm-import-meta-main-eval"
"test-worker-debug"
"test-worker-track-unmanaged-fds"

After that, everything except for python313Packages.aiohttp built, which is failing due to the CVE-2026-3644 fix in #508075. There is an open PR upstream to fix it at aio-libs/aiohttp#12395, but I’ll leave it for the maintainers to cherry-pick or for upstream to commit a fix. I’m not touching something sensitive outside my usual area that just to fix a build.

This mirrors the Darwin libiconv package, which does not provide a setup
hook. It is expected that libiconv will be linked explicitly on Darwin.
The Darwin libiconv tries to be compatible with GNU libiconv, but it’s
not. Recent versions of Autoconf and gnulib include checks for issues in
Darwin’s libiconv implementation, which has effectively turned
`autoreconfHook` into `autoBreakDarwinHook` due to failing to link
libiconv. Instead of continuing to work around it, make GNU libiconv the
default. With the UTF-8-MAC patch, it should be a drop-in replacement.
@balsoft balsoft moved this from Reviewed to Needs Re-review in Nixpkgs security review Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: darwin Running or building packages on Darwin 6.topic: stdenv Standard environment 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: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

Status: Needs Re-review
Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants