Skip to content

Commit 8f762e2

Browse files
authored
Remove absolute path from libpython.dylib (#2256)
Previously this set the install name of the binary, which is put into any binaries that link this, as an absolute path that is user specific. Instead this can be fetched relatively, and bazel will automatically handle adding the correct rpaths for this.
1 parent 2d34f6c commit 8f762e2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

python/private/python_repository.bzl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,11 @@ def _python_repository_impl(rctx):
143143
# dyld lookup errors. To fix, set the full path to the dylib as
144144
# it appears in the Bazel workspace as its LC_ID_DYLIB using
145145
# the `install_name_tool` bundled with macOS.
146-
dylib = "lib/libpython{}.dylib".format(python_short_version)
147-
full_dylib_path = rctx.path(dylib)
146+
dylib = "libpython{}.dylib".format(python_short_version)
148147
repo_utils.execute_checked(
149148
rctx,
150149
op = "python_repository.FixUpDyldIdPath",
151-
arguments = [repo_utils.which_checked(rctx, "install_name_tool"), "-id", full_dylib_path, dylib],
150+
arguments = [repo_utils.which_checked(rctx, "install_name_tool"), "-id", "@rpath/{}".format(dylib), "lib/{}".format(dylib)],
152151
logger = logger,
153152
)
154153

0 commit comments

Comments
 (0)