-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix dylib linking for Mac app bundles #12711
base: dev
Are you sure you want to change the base?
Conversation
Package Changes Through b4cdbc7There are 8 changes which include tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor, tauri-bundler with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Make sure to point |
I have tested it. as it turned out, I need to swap a whole tree of tauri dependencies, including all plugins used. But the PR seems to work. |
@shi-yan fyi rust has a feature for this: https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html |
} | ||
} | ||
|
||
let status = Command::new("codesign") |
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.
we have our own signing management via the sign_paths
variable in this module, we should reuse it (maybe we don't even need to codesign here?)
return Ok(()); | ||
} | ||
|
||
let should_fix_dylib = settings |
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.
shouldn't we always run this?
Problem
Currently, Tauri allows packaging additional
.dylib
libraries and frameworks, but it does not fix their linking in the final bundled app.For example, in my case, I use the
rust-opencv
library, which links to OpenCV libraries installed via Homebrew:While Tauri can bundle these
.dylib
files, it does not adjust the binary to correctly reference them. If I deploy my app to another computer without these libraries, the app crashes. Worse, if the new system has a different version of the library installed, the app will also crash due to version mismatches.Solution
To fix this, I added an additional bundling step that:
.dylib
files using@rpath
..dylib
files themselves to use@rpath
instead of absolute paths.rpath
to locate the bundled libraries inContents/Frameworks
.This mirrors what the following Bash script does manually:
Since this script needs to run before generating the
.dmg
file, I added an extra step in Tauri’s bundling process to automate it.Issue
To control whether this step runs, I introduced a new configuration option:
By default, this option is
false
to avoid breaking existing setups.However, when testing locally with
cargo tauri build
, I encountered the following error:Do you know a way to workaround this error?