-
Notifications
You must be signed in to change notification settings - Fork 328
Native libraries from packages are not copied #13101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native libraries from packages are not copied #13101
Conversation
Setting
|
Setting
|
After few discussions with @JaroslavTulach, I have arrived at a working solution demonstrated in https://github.com/Akirathan/native-lib-loader. Discussed also in GraalVM Slack. This solution explicitly changes the com.oracle.svm.core.jdk.NativeLibraries#usrPaths field at runtime. Now, it is time to integrate this idea into Enso.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
I have downloaded the
(
|
Just an idea for the long term sustainability vision. In any case I am glad you got it working with |
.../runtime/src/main/java/org/enso/interpreter/runtime/nativeimage/NativeLibrarySearchPath.java
Outdated
Show resolved
Hide resolved
* | ||
* @param path Directory to add to the search path. | ||
*/ | ||
public static void addToSearchPath(String path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use a real type like Path
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only callsite uses TruffleFile
. Better String
than TruffleFile
.
NativeLibraryFinder.listAllNativeLibraries(pkg, FileSystem$.MODULE$.defaultFs()); | ||
for (var nativeLib : nativeLibs) { | ||
var out = new File(nativeLibDir, nativeLib.getName()); | ||
Files.copy(nativeLib.toPath(), out.toPath(), StandardCopyOption.REPLACE_EXISTING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heuréka, if the system continues to work even after removing these copies!
Closes #12557
Pull Request Description
Removes the copying of native libraries next to the generated NI binary. Native libraries of packages are loaded from the same location in both JVM and AOT modes.
Old behavior: EnsoLibraryFeature copies all the native libraries within
**/polyglot/lib/**
next to the generated NI binary. The motivation for that is mentioned in the description of #11874.New behavior: EnsoLibraryFeature no longer copies native libraries. Instead, once a package is loaded in DefaultPackageRepository.registerPackageInternal, paths to its native libraries are added to the native library search path via NativeLibrarySearchPath. Inspired by https://github.com/Akirathan/native-lib-loader.
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.