@@ -559,6 +559,14 @@ def add_rpath_for_cmake_build(args, rpath):
559
559
note (' ' .join (add_rpath_cmd ))
560
560
subprocess .call (add_rpath_cmd , stderr = subprocess .PIPE )
561
561
562
+ def get_swift_backdeploy_library_paths (args ):
563
+ if platform .system () == 'Darwin' :
564
+ # Need to include backwards compatibility libraries for Concurrency
565
+ # FIXME: Would be nice if we could get this from `swiftc -print-target-info`
566
+ return ['/usr/lib/swift' , args .target_info ["paths" ]["runtimeLibraryPaths" ][0 ] + '/../../swift-5.5/macosx' ]
567
+ else :
568
+ return []
569
+
562
570
def build_swiftpm_with_cmake (args ):
563
571
"""Builds SwiftPM using CMake."""
564
572
note ("Building SwiftPM (with CMake)" )
@@ -590,6 +598,10 @@ def build_swiftpm_with_cmake(args):
590
598
add_rpath_for_cmake_build (args , os .path .join (args .build_dirs ["swift-system" ], "lib" ))
591
599
add_rpath_for_cmake_build (args , os .path .join (args .build_dirs ["swift-collections" ], "lib" ))
592
600
601
+ # rpaths for compatibility libraries
602
+ for lib_path in get_swift_backdeploy_library_paths (args ):
603
+ add_rpath_for_cmake_build (args , lib_path )
604
+
593
605
def build_swiftpm_with_swiftpm (args , integrated_swift_driver ):
594
606
"""Builds SwiftPM using the version of SwiftPM built with CMake."""
595
607
@@ -739,6 +751,10 @@ def get_swiftpm_flags(args):
739
751
# toolchains that include libraries not part of the OS (e.g. PythonKit or
740
752
# TensorFlow).
741
753
if platform .system () == "Darwin" :
754
+ # rpaths for compatibility libraries
755
+ for lib_path in get_swift_backdeploy_library_paths (args ):
756
+ build_flags .extend (["-Xlinker" , "-rpath" , "-Xlinker" , lib_path ])
757
+
742
758
swift_library_rpath_prefix = "@executable_path/../"
743
759
elif platform .system () == 'Linux' or platform .system () == 'OpenBSD' :
744
760
# `$ORIGIN` is an ELF construct.
0 commit comments