-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
lapack: fix darwin library identifiers #85952
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
Conversation
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
@@ -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} \ |
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.
this look correct to me, does removing this fix the problem?
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.
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.
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.
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
.
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.
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
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 have no idea how rpath on a dylib behaves, but I'm not sure that dlopen needs or uses the library identifier.
@GrahamcOfBorg build python2Packages.numpy |
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.
Fixes numpy
Tested with running nixpkgs-review to build ~500 packages out of ~2000
Motivation for this change
The build system already sets these properly to the absolute path so no
need to patch the libraries on darwin.
Fixes #85713
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)