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
librsvg: fix build on darwin #84458
librsvg: fix build on darwin #84458
Conversation
librsvg needs -lobjc ldflag on darwin https://gitlab.gnome.org/GNOME/librsvg/-/issues/545
ec2368c
to
c47c865
Compare
buildInputs = [ libxml2 bzip2 pango libintl ] | ||
++ lib.optionals stdenv.isDarwin [ darwin.libobjc ]; | ||
|
||
NIX_LDFLAGS = if stdenv.isDarwin then "-lobjc" else null; |
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.
A bit hacky / confusing but rewriting this as
${if stdenv.hostPlatform.isDarwin then "NIX_LDFLAGS" else null } = "-lobjc";
should avoid a Linux rebuild for now if that's a concern here.
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.
Hehe, that's neat, didn't actually know it was possible to circumvent the problem this way (though that should ideally be the meaning of foo = null
tbh.).
If we want to target master then I think we do want this hack, preferably with a FIXME
comment.
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'm inclined to the initial version, because is more easy to understand; but I don't mind updating it. Please let me know if we are going to use this approach
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.
Yours' definitely much clearer so I would also be in favour of that. I think I may have left my comment at the time there was still a change triggering a Linux rebuild, as that's no longer an issue so you can just dismiss my comment.
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.
Right, I guess optionalString
returns an empty string when false (which does make sense), but foo = null
actually works the way we want. That makes it a lot more palatable indeed :)
Motivation for this change
librsvg needs -lobjc ldflag on darwin
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)