Skip to content

Commit

Permalink
Fix paths for dylibs for Apple platforms
Browse files Browse the repository at this point in the history
Embedded paths in dylibs are absolute paths of
where they were built. This makes it so that on CI
it embeds the full CI path of artefacts which is then
traversed and the binary is not found when linking.

To fix that `install_name_tool` must be used

Signed-off-by: Lukas Pukenis <[email protected]>
  • Loading branch information
LukasPukenis committed Oct 3, 2024
1 parent 4f1ecf8 commit 3f8563b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions rust_build_utils/darwin_build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,16 @@ def create_xcframework(
command = ["xcodebuild", "-create-xcframework"]

for target_os in target_os_list:
command.extend(
[
"-library",
str(
get_universal_library_distribution_directory(
project, target_os, debug
)
/ library_file_name
),
]
lib_path = str(
get_universal_library_distribution_directory(project, target_os, debug)
/ library_file_name
)

# fix @rpath
subprocess.run(
["install_name_tool", "-id", f"@rpath/{library_file_name}", lib_path]
)
command.extend(["-library", lib_path])
command.extend(["-headers", str(temp_headers)])

command.extend(["-output", str(framework_path)])
Expand Down

0 comments on commit 3f8563b

Please sign in to comment.