-
Notifications
You must be signed in to change notification settings - Fork 12
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
Update to JavaCPP 1.5.4 and use Loader.Detector.getPlatform to avoid "java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path" message #24
Conversation
I think this should download the binaries only for |
@lloydmeta |
To be honest, I haven't really even used javacpp in years, so I'm not sure what is required here. Is this a request to amend this PR or just a general question? or a further enhancement question? |
From what I understand, it downloads only one platform specific artifact for each library here: val generic = "org.bytedeco" % "javacpp" % javaCppVersion.value classifier ""
val platformSpecific = javaCppPlatform.value.map { platform =>
"org.bytedeco" % "javacpp" % javaCppVersion.value classifier platform
}
generic +: platformSpecific Does that make sense? |
@saudet Even if I change to this, all the OS jar files are downloaded to libraryDependencies ++= {
if (after1_5_3(javaCppVersion.value)) {
val generic = "org.bytedeco" % "javacpp" % javaCppVersion.value classifier ""
val platformSpecific = javaCppPlatform.value.map { platform =>
"org.bytedeco" % "javacpp" % javaCppVersion.value classifier platform
}
generic +: platformSpecific
} else {
Seq("org.bytedeco" % "javacpp" % javaCppVersion.value jar)
}
}, I think because of this line. I also used |
Yes, that's what I mean, it shouldn't use javacpp-platform, unless we can modify it to filter the dependencies like this:
https://github.com/bytedeco/gradle-javacpp#the-platform-plugin
|
@saudet I cannot write like this.
|
@saudet def getPlatform: String = {
val jvmName = System.getProperty("java.vm.name", "").toLowerCase
var osName = System.getProperty("os.name", "").toLowerCase
var osArch = System.getProperty("os.arch", "").toLowerCase
val abiType = System.getProperty("sun.arch.abi", "").toLowerCase
val libPath = System.getProperty("sun.boot.library.path", "").toLowerCase
if (jvmName.startsWith("dalvik") && osName.startsWith("linux")) osName = "android"
else if (jvmName.startsWith("robovm") && osName.startsWith("darwin")) {
osName = "ios"
osArch = "arm"
}
else if (osName.startsWith("mac os x") || osName.startsWith("darwin")) osName = "macosx"
else {
val spaceIndex = osName.indexOf(' ')
if (spaceIndex > 0) osName = osName.substring(0, spaceIndex)
}
if (osArch == "i386" || osArch == "i486" || osArch == "i586" || osArch == "i686") osArch = "x86"
else if (osArch == "amd64" || osArch == "x86-64" || osArch == "x64") osArch = "x86_64"
else if (osArch.startsWith("aarch64") || osArch.startsWith("armv8") || osArch.startsWith("arm64")) osArch = "arm64"
else if (osArch.startsWith("arm") && ((abiType == "gnueabihf") || libPath.contains("openjdk-armhf"))) osArch = "armhf"
else if (osArch.startsWith("arm")) osArch = "arm"
osName + "-" + osArch
}
//libraryDependencies += "org.bytedeco" % "javacpp-platform" % "1.5.3"
libraryDependencies += "org.bytedeco" % "javacpp" % "1.5.3"
libraryDependencies += "org.bytedeco" % "javacpp" % "1.5.3" classifier getPlatform |
Why not? What happens? |
I'm assuming the libraryDependencies in build.sbt are the dependencies for the plugin itself? |
Also, this line here should be changed to |
Yes. It is necessary for this line. sbt-javacpp uses javacpp. What should we do? We cannot escape from
OK. This is a new API of 1.5.4. |
ec8026f
to
cdefbba
Compare
…ang.UnsatisfiedLinkError: no jnijavacpp in java.library.path" message.
cdefbba
to
49e3c2f
Compare
@saudet @lloydmeta |
Looks good to me! Thanks |
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 Scala-side changes LGTM.
Does this need a minor version bump of the SBT plugin ?
Yes. Please. |
Thanks. Done and released as 1.17 |
@lloydmeta |
Because of bytedeco/javacv#1305 , you have to use
javacpp-platform
from JavaCPP 1.5.3.You can avoid
java.lang.UnsatisfiedLinkError: no jnijavacpp in java.library.path
message by this.