-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nixStatic: fix darwin build #356983
nixStatic: fix darwin build #356983
Conversation
NIX_LDFLAGS = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic) | ||
"-framework CoreFoundation -framework SystemConfiguration"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other packages use buildInputs
for this, and actual CoreFoundation
(etc.) packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think adding the package will actually cause the build to link against the framework. The issue I am adding these is that I see missing symbols when linking libcurl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally these forced linkages mean something is broken with the build upstream, I think.
(Also the separate framework packages are deprecated compatibility stubs now and do nothing at all.)
(pkgs.runCommand "iconv-pkgconfig" {} '' | ||
mkdir -p $out/lib/pkgconfig | ||
cat > $out/lib/pkgconfig/iconv.pc <<EOF | ||
prefix=${iconv} | ||
|
||
Name: iconv | ||
Description: GNU iconv | ||
Version: ${lib.getVersion iconv} | ||
Libs: -liconv | ||
EOF | ||
'') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely there's a better way to fix this, but if this gets the job done, I'm not opposed.
I guess you could use writeTextFile
here, but that's obviously not the problem.
Yeah if we can just make sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apple doesn’t ship a .pc
file for libiconv
so it seems like an issue of the Nix build system if it’s requiring it on macOS.
NIX_LDFLAGS = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isStatic) | ||
"-framework CoreFoundation -framework SystemConfiguration"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally these forced linkages mean something is broken with the build upstream, I think.
(Also the separate framework packages are deprecated compatibility stubs now and do nothing at all.)
Libs: -liconv | ||
EOF | ||
'') | ||
iconv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you want this? This is the iconv(1)
binary. libiconv
is already provided by the base SDK.
This is an upstream non‐portable brokenness that causes problems with other platforms like musl too: libarchive/libarchive#1819 libarchive/libarchive#1766. AFAICT it’s wrong on glibc too, it just happens to work by accident somehow(?). It seems it was a regression introduced for MSYS2 support or something. I don’t think any major We should fix it by fixing the The |
BTW this package has been broken since 2023 so I don’t think it’s any kind of blocker. Static builds are pretty niche on macOS. If we fix it, we should fix it the right way, not by hacking around bugs in other packages and Nix’s build system like this. |
Well. Should we just disable it those libarchive fixes are in. This would take another staging cycle? It would make my life as a nix maintainer easier. |
In the near time, I don't think I have the capacity to do the suggested refactorings. My goal was just to get a clean nixpkgs review for nix upgrade. In any case as a proper fix would take a staging cycle, I would suggest to disable static nix darwin builds for now so it doesn't waste build cycles on peoples machines / hydra. |
Things done
Depends on #355350nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.