Skip to content

Commit e61ec4c

Browse files
authored
[TF] install_name_dir workaround for Python and TensorFlow modules. (#25328)
`install_name_dir` for the standard library has been changed from @rpath to /usr/lib/swift in #24382. This patch resolves linker issues on macOS: "Library not loaded: /usr/lib/swift/libswiftTensorFlow.dylib" See tensorflow/swift-apis#136 for more information.
1 parent 3e64647 commit e61ec4c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

stdlib/public/Python/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,7 @@ add_swift_target_library(swiftPython ${SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES} IS
4040
SWIFT_MODULE_DEPENDS_CYGWIN Glibc
4141
SWIFT_MODULE_DEPENDS_HAIKU Glibc
4242
SWIFT_COMPILE_FLAGS "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
43-
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
43+
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
44+
# NOTE: This is a workaround for https://github.com/apple/swift/pull/24382,
45+
# which changed the default install_name_dir to `/usr/bin/swift`.
46+
DARWIN_INSTALL_NAME_DIR "@rpath")

stdlib/public/TensorFlow/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,7 @@ add_swift_target_library(swiftTensorFlow ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_
6767
SWIFT_COMPILE_FLAGS "${swift_stdlib_compile_flags}"
6868
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
6969
INSTALL_IN_COMPONENT stdlib
70-
EXTRA_RPATHS "${SWIFT_TENSORFLOW_TARGET_LIB_DIR}")
70+
EXTRA_RPATHS "${SWIFT_TENSORFLOW_TARGET_LIB_DIR}"
71+
# NOTE: This is a workaround for https://github.com/apple/swift/pull/24382,
72+
# which changed the default install_name_dir to `/usr/bin/swift`.
73+
DARWIN_INSTALL_NAME_DIR "@rpath")

0 commit comments

Comments
 (0)