Skip to content

Commit ebe8f36

Browse files
committed
Merge pull request godotengine#96970 from bruvzg/macos_lib_path
[macOS] Fix dynamic library lookup for system libraries.
2 parents 7174e21 + 8d03914 commit ebe8f36

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

platform/macos/os_macos.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@
230230
path = get_framework_executable(get_executable_path().get_base_dir().path_join("../Frameworks").path_join(p_path.get_file()));
231231
}
232232

233-
ERR_FAIL_COND_V(!FileAccess::exists(path), ERR_FILE_NOT_FOUND);
233+
if (!FileAccess::exists(path)) {
234+
// Try using path as is. macOS system libraries with `/usr/lib/*` path do not exist as physical files and are loaded from shared cache.
235+
path = p_path;
236+
}
234237

235238
p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
236239
ERR_FAIL_NULL_V_MSG(p_library_handle, ERR_CANT_OPEN, vformat("Can't open dynamic library: %s. Error: %s.", p_path, dlerror()));

0 commit comments

Comments
 (0)