-
Notifications
You must be signed in to change notification settings - Fork 103
Fix the library install name and path #352
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 install_name is supposed to be an absolute path, and use the soname rather than the developer symlink. Avoids using DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib Homebrew changes the install_name downstream, in /opt. Signed-off-by: Anders F Björklund <[email protected]>
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.
Thanks for the PR! I think that we should fix this the same way we did in Linux, by using rustc-cdylib-link-arg
to pass -install_name
, -current_version
, and -compatibility_version
.
Added the linker flags. We still need to rename and relocate the library, though. |
@@ -5,5 +5,10 @@ fn main() { | |||
std::env::var("CARGO_PKG_VERSION_MAJOR").unwrap() | |||
); | |||
#[cfg(target_os = "macos")] | |||
println!( | |||
"cargo:rustc-cdylib-link-arg=-Wl,-install_name,libkrun.{}.dylib,-compatibility_version,1.0.0,-current_version,{}.0.0", | |||
std::env::var("CARGO_PKG_VERSION_MAJOR").unwrap(), std::env::var("CARGO_PKG_VERSION_MINOR").unwrap() |
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.
Reading ld
's manual, I'd say compatibility_version
should be MAJOR.0.0
, and current_version
MAJOR.MINOR.RELEASE
.
Signed-off-by: Anders F Björklund <[email protected]>
b0f7fd4
to
b317bdc
Compare
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.
LGTM, thanks!
The install_name is supposed to be an absolute path, and use the soname rather than the developer symlink.
Avoids using
DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib
. Homebrew changes the install_name downstream, in /opt.The default is the absolute path of the build directory (not wanted)
Typical error:
dyld[36629]: Library not loaded: libkrun-efi.dylib