Skip to content
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

jxrlib: fix/enable for darwin #95625

Merged
merged 1 commit into from Sep 5, 2020
Merged

Conversation

risicle
Copy link
Contributor

@risicle risicle commented Aug 16, 2020

Motivation for this change

In #92708 we're looking at unbundling libs from freeimage, but doing so means adding jxrlib as a dependency of freeimage. Without darwin support for jxrlib this will result in no freeimage for darwin. Fix this.

Builds for me, macos 10.14.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@@ -13,6 +13,12 @@ stdenv.mkDerivation rec {
sha256 = "0rk3hbh00nw0wgbfbqk1szrlfg3yq7w6ar16napww3nrlm9cj65w";
};

postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace Makefile \
--replace '-shared' '-dynamiclib -undefined dynamic_lookup' \
Copy link
Member

Choose a reason for hiding this comment

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

What does -dynamiclib do out of interest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell it's the darwin equivalent of -shared. -undefined dynamic_lookup makes the linker tolerate missing symbols that it assumes will be resolved by other libs at runtime.

I have no real knowledge of this, I discovered these with a lot of painful googling. As I was doing this, I was wishing that whatever macos gurus we had would write us a simple "macos for linux people" cheat sheet - it would do wonders for macos support.

But then I remembered that it'd all only apply until the big macos 11 shakeup, and who knows what the future will be after that...

@risicle
Copy link
Contributor Author

risicle commented Sep 5, 2020

Merging this - it's fairly harmless...

@risicle risicle merged commit 9b4ea9a into NixOS:master Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants