Skip to content

Commit 07d3d5d

Browse files
committed
Allow to use CLibraryPath to load Java static libraries
1 parent 7fbde87 commit 07d3d5d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/c/NativeLibraries.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,17 @@ private static LinkedHashSet<String> initCLibraryPath() {
326326
String libraryLocationHint = System.lineSeparator() + "(search path: " + jdkLibDir + ")";
327327
hint = defaultBuiltInLibraries.stream().filter(hasStaticLibrary.negate()).collect(Collectors.joining(", ", "Missing libraries: ", libraryLocationHint));
328328
}
329+
330+
/* Probe for static JDK libraries in user-specified CLibraryPath directory */
331+
if (staticLibsDir == null) {
332+
for (String clibPathComponent : SubstrateOptions.CLibraryPath.getValue().values()) {
333+
Path path = Paths.get(clibPathComponent);
334+
Predicate<String> hasStaticLibraryCLibraryPath = s -> Files.isRegularFile(path.resolve(getStaticLibraryName(s)));
335+
if (defaultBuiltInLibraries.stream().allMatch(hasStaticLibraryCLibraryPath)) {
336+
return libraryPaths;
337+
}
338+
}
339+
}
329340
} catch (IOException e) {
330341
/* Fallthrough to next strategy */
331342
hint = e.getMessage();

0 commit comments

Comments
 (0)