Add xgboost4j support FreeBSD#12222
Open
huanghwh wants to merge 2 commits into
Open
Conversation
Contributor
|
@trivialfis @hcho3, would you help check it? |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds FreeBSD as a supported platform for the XGBoost JVM bindings by teaching the Java native library loader and JNI packaging script to recognize and place FreeBSD native artifacts under the expected resource path.
Changes:
- Add
FREEBSDtoNativeLibLoader.OSand OS detection logic, and include a FreeBSD-specific OpenMP dependency hint on load failure. - Update the JNI build/packaging script to copy the native library into a
freebsd/<arch>resource directory.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/NativeLibLoader.java | Adds FreeBSD OS enum/detection and updates supported-OS docs + load-failure messaging. |
| jvm-packages/create_jni.py | Adds FreeBSD mapping so the built .so is copied into the correct freebsd resources folder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
62
to
72
| static OS detectOS() { | ||
| String os = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); | ||
| if (os.contains("mac") || os.contains("darwin")) { | ||
| return MACOS; | ||
| } else if (os.contains("win")) { | ||
| return WINDOWS; | ||
| } else if (os.contains("nux")) { | ||
| return LINUX; | ||
| } else if (os.contains("freebsd")) { | ||
| return FREEBSD; | ||
| } else if (os.contains("sunos")) { |
| break; | ||
| case FREEBSD: | ||
| logger.error(failureMessageIncludingOpenMPHint); | ||
| logger.error("You may need to install 'libomp.so'"); |
Author
There was a problem hiding this comment.
In FreeBSD, libomp.so is in base system, no libgomp.so.
hcho3
approved these changes
May 25, 2026
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.
I use this command to build and test: