Skip to content

Commit 372f98c

Browse files
committed
For scripts, use DYLD_FRAMEWORK/LIBRARY_PATH to find frameworks / runtimes.
Add DYLD_FRAMEWORK_PATH=/System/Library/Frameworks to the environment when constructing swift-frontend invocations for the interpreter so that dlopen can find autolinked frameworks. This is intended to fix #68785. As a follow-up: don't expand runtime paths to find the path to the runtime in libImmediate, but instead hard-code "/usr/lib/swift/libswiftCore.dylib" and allow any overrides to be found via DYLD_LIBRARY_PATH (this ensures that dyld treats whichever libswiftCore.dylib is found as override for the one in the shared cache, which doesn't happen if dlopen is passed a non-standard path).
1 parent 6fd9817 commit 372f98c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Immediate/Immediate.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ void *swift::immediate::loadSwiftRuntime(ArrayRef<std::string>
8686
runtimeLibPaths) {
8787
#if defined(_WIN32)
8888
return loadRuntimeLib("swiftCore" LTDL_SHLIB_EXT, runtimeLibPaths);
89-
#else
89+
#elif (defined(__linux__) || defined(_WIN64) || defined(__FreeBSD__))
9090
return loadRuntimeLib("libswiftCore" LTDL_SHLIB_EXT, runtimeLibPaths);
91+
#else
92+
return loadRuntimeLib("libswiftCore" LTDL_SHLIB_EXT, {"/usr/lib/swift"});
9193
#endif
9294
}
9395

0 commit comments

Comments
 (0)