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

lapack: fix darwin library identifiers #85952

Merged
merged 1 commit into from Apr 26, 2020
Merged

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Apr 24, 2020

Motivation for this change

The build system already sets these properly to the absolute path so no
need to patch the libraries on darwin.

$ otool -D result/lib/liblapacke.dylib
result/lib/liblapacke.dylib:
/nix/store/k88gy5s765yn3dc5ws3jbykyvklm7z96-openblas-0.3.8/lib/libopenblasp-r0.3.8.dylib

Fixes #85713

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 inkscape
  • 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.

The build system already sets these properly to the absolute path so no
need to patch the libraries on darwin.

    $ otool -D result/lib/liblapacke.dylib
    result/lib/liblapacke.dylib:
    /nix/store/k88gy5s765yn3dc5ws3jbykyvklm7z96-openblas-0.3.8/lib/libopenblasp-r0.3.8.dylib

Fixes NixOS#85713
@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Apr 24, 2020
@ofborg ofborg bot requested a review from ttuegel April 24, 2020 18:52
@@ -54,10 +54,6 @@ stdenv.mkDerivation {
'' + (if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf" then ''
patchelf --set-soname liblapack${canonicalExtension} $out/lib/liblapack${canonicalExtension}
patchelf --set-rpath "$(patchelf --print-rpath $out/lib/liblapack${canonicalExtension}):${lapackProvider}/lib" $out/lib/liblapack${canonicalExtension}
'' else if stdenv.hostPlatform.isDarwin then ''
install_name_tool -id liblapack${canonicalExtension} \
Copy link
Member

Choose a reason for hiding this comment

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

this look correct to me, does removing this fix the problem?

Copy link
Member Author

Choose a reason for hiding this comment

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

No library identifiers should the absolute path to the dylib, with this the linker wil try to find $PWD/liblapack.dylib which obviously won't exsist in the numpy build, etc.

Copy link
Member Author

@LnL7 LnL7 Apr 24, 2020

Choose a reason for hiding this comment

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

Also rpaths are not really used on darwin so that won't do much . And if a build really wants rpaths, but that's basically only ever done for internal libraries, this would have to be something like @rpath/lib/liblapack.dylib.

Copy link
Member

Choose a reason for hiding this comment

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

the important thing is that in mkl it gets the ${mkl}/lib directory in the RPATH so that it can use dlopen to find the proper. Also ideally the name would be liblapack.dylib so that you could provide a custom value DYLD_LIBRARY_PATH, even if it was linked against openblas/mkl, but that may not work as I expected on macOS

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea how rpath on a dylib behaves, but I'm not sure that dlopen needs or uses the library identifier.

@veprbl
Copy link
Member

veprbl commented Apr 25, 2020

@GrahamcOfBorg build python2Packages.numpy
@GrahamcOfBorg build python3Packages.numpy

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

Fixes numpy
Tested with running nixpkgs-review to build ~500 packages out of ~2000

@veprbl veprbl merged commit f0da3b5 into NixOS:master Apr 26, 2020
@LnL7 LnL7 deleted the darwin-lapack branch April 26, 2020 05:44
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.

nixpkgs-unstable blocked by failing inkscape on darwin
3 participants