Skip to content
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

Problem: Compilation fails on CentOS, due to duplicate lib entry. #1302

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions zproject_java.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,7 @@ dependencies {
// Build section

task copyLibs(type: Copy) {
def libraryPaths = System.getProperty('java.library.path').split(File.pathSeparator).toList()
libraryPaths.add('/usr/local/lib')
if (osdetector.os == 'windows') {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build/Release")
} else {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build")
}
def libraryPaths = []
if (project.hasProperty('buildPrefix')) {
if (osdetector.os == 'windows') {
// DLLs are installed to the bin directory by cmake
Expand All @@ -447,6 +441,18 @@ task copyLibs(type: Copy) {
libraryPaths.add("${project.buildPrefix}/lib")
}

def javaLibraryPaths = System.getProperty('java.library.path').split(File.pathSeparator).toList()
libraryPaths.addAll (javaLibraryPaths)

libraryPaths.add('/usr/local/lib')
if (osdetector.os == 'windows') {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build/Release")
} else {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build")
}

def oldStrategy = duplicatesStrategy
duplicatesStrategy = DuplicatesStrategy.WARN
libraryPaths.each { path ->
from path
include '$(project.libname)jni.so'
Expand All @@ -462,6 +468,7 @@ task copyLibs(type: Copy) {
. endfor
into 'build/natives'
}
duplicatesStrategy = oldStrategy
}

jar.baseName = "$(project.prefix:c)-jni-${osdetector.classifier}"
Expand Down