GH-657: Set JNA library loading symbol visibility#658
Open
lriggs wants to merge 3 commits intoapache:mainfrom
Open
GH-657: Set JNA library loading symbol visibility#658lriggs wants to merge 3 commits intoapache:mainfrom
lriggs wants to merge 3 commits intoapache:mainfrom
Conversation
Added jna library which allows more control over native code loading
This comment has been minimized.
This comment has been minimized.
lidavidm
reviewed
Mar 7, 2025
| NativeLibrary.getInstance( | ||
| libraryFile.getAbsolutePath(), | ||
| Collections.singletonMap(Library.OPTION_OPEN_FLAGS, new Integer(RTLD_LAZY | RTLD_GLOBAL))); | ||
| System.load(libraryFile.getAbsolutePath()); |
Member
There was a problem hiding this comment.
Is this still necessary if we're using the JNA version?
Member
There was a problem hiding this comment.
I don't think this is strictly required with JNA imho.
| final String libraryToLoad = | ||
| LIBRARY_NAME + "/" + getNormalizedArch() + "/" + System.mapLibraryName(LIBRARY_NAME); | ||
| final File libraryFile = moveFileFromJarToTemp(tmpDir, libraryToLoad, LIBRARY_NAME); | ||
| NativeLibrary.getInstance( |
Member
There was a problem hiding this comment.
Doesn't the NativeLibrary instance need to be disposed somewhere?
Member
There was a problem hiding this comment.
Why not also leveraging java.library.path system prop ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's Changed
Set the Lazy and Global flags when loading the Gandiva library for JNI so that system functions are visible to the compiled LLVM code.
See also apache/arrow#41497 for much past discussion on this same fix.
Closes #657 and apache/arrow#40839.