-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
libiconvReal: implement ABI compatibility on Darwin #238993
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 wonder if it might not be a good idea to export both versions of symbols to increase compatibility with the Linux version?
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.
Both glibc and Musl use the
iconv
prefix. The reason for thelibiconv
prefix in GNU libiconv is to allow it to be used on systems that provide their own implementations in libc. However, on Darwin, the system implementation is GNU libiconv, and it’s being (or will be) replaced with this version.As far as I can tell, (almost?) all Linux packages in nixpkgs use
iconv
from libc (glibc or Musl). It’s possible a Darwin app might link both the system and the separate libiconv, but I’d like to see an actual example before attempting to support that use case. I’d had to add to Darwin’s maintenance load to support something no one actually does.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.
Aha, makes sense. I just worry about having the same
pkgs.libiconvReal
with different behaviour across platforms, even though it's probably not going to come up. How would you feel about adding aforDarwinStdenv
(or whatever) option to the package to conditionalize this logic on, and setting that in thepkgs.libiconv
logic rather than changingpkgs.libiconvReal
directly?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.
Maybe call it
enableDarwinABICompat
and default it tostdenv.hostplatform.isDarwin
? If a package wants to do something wacky, it can override the compatibility and use both. I’ve pushed an updated branch with that change. Let me know what you think.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.
My suggestion is to call it e.g.
useLibcAbi
, default it tofalse
, and then adjustall-packages.nix
in this manner:Advantages: one fewer Darwin-specific conditional, might fix issues on other platforms that currently use
libiconvReal
here with probably the wrong ABI for the use-case, keeps the comment above it accurate ("We also providelibiconvReal
, which will always be a standalone libiconv, just in case you want it regardless of platform." – I think if we provide something calledlibiconvReal
with this documentation it should match the API/ABI of the actual standalone libiconv, so if we do something other than this I think we need to change the name and comment. But it seems fine to me to just do the override inlibiconv
's definition, because it expresses what we want from it.)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.
As discussed on Matrix, I’d like to keep the change conservative and targeted at Darwin for now. Other platforms may have their own iconv implementation, so it would be a misnomer to call that the “libc ABI”. I also don’t want to propagate Darwin’s quirk in reexporting
libcharset
. At least for now, I’ll be keeping the name but defaulting it tofalse
.When it comes time to switch Darwin to this implementation, the definition of
libiconv
can be updated tolibiconvReal.override { enableDarwinABICompat = true; }
. That will require updates to a few other packages that reference darwin.libiconv directly and the implementation of a deprecation mechanism for thedarwin
attrset.Thanks for the feedback! I’ve pushed a commit that defaults this to off.