-
-
Notifications
You must be signed in to change notification settings - Fork 4
fix: Compilation error on default JDK8 #41
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
base: main
Are you sure you want to change the base?
Conversation
@Xuanwo I have fixed the CI checks, if needed I can split the changes |
@@ -28,11 +28,16 @@ fn find_jvm() -> Result<()> { | |||
println!("cargo:rustc-link-lib=jvm"); | |||
println!("cargo:rustc-link-search=native={jvm_path}"); | |||
|
|||
// Add JVM to rpath | |||
println!("cargo:rustc-link-arg=-Wl,-rpath,{jvm_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.
Rust specs ensures this does not propagate upwards(unless it is a cdylib, which will then have this in its RPATH), so this is not a security concern, only relevant for tests and/or binaries from this crate.
It is also why we export the used path as metadata below, if another crate does need it, it can use it directly
This resolves an issue where header files are not found when compiling using the default JDK8 installation on Ubuntu(A problem which plague any JDK8 installation that does not set JAVA_HOME, I would presume), since
java-locator
was searching for the Java Runtime binary, which on JDK8 was in thejre
subfolder instead of the JDK root, whose bin folder only held a symlink.Using the
locate-jdk-only
feature,java-locator
searches for thejavac
binary instead ofjava
, which resolves this problem.In order to not break the build for systems that only have the JRE installed and just want to link against libhdfs, I've attached the
locate-jdk-only
feature to thevendored
feature, where we would need the JDK anyway.This leaves an issue where the problem could still occur if libhdfs is not found and we only build it as a fallback, I've added a warning message there recommending enabling the "vendored" feature in case of header troubles.
You can read more in the java-locator PR:
astonbitecode/java-locator#7