Extra help for finding "cast" native library on macOS

Unlike Linux, macOS has no "RPATH" facility for embedding additional
search paths within shared libraries.  Instead, we need to set
"DYLD_LIBRARY_PATH" appropriately in the environment.  This
environment variable is the macOS analogue of "LD_LIBRARY_PATH" on
Linux.

Note that adding the required path to the "java.library.path" system
property will *not* work.  This property only affects where the JVM
looks for shared objects that it is loading directly.  This property
does not influence the search for other, transitively-required shared
objects.

Fixes #3.
This commit is contained in:
Ben Liblit 2018-02-26 21:55:27 -06:00
parent 48ffce525c
commit bcbd298808
1 changed files with 4 additions and 4 deletions

View File

@ -97,9 +97,9 @@ model {
def lib = linkXlator_testSharedLibrary
dependsOn lib
systemProperty 'java.library.path', lib.destinationDir
// TODO: compute path on following line from 'cast' library properties somehow
def castLibDir = "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared"
environment 'DYLD_LIBRARY_PATH', castLibDir
}
}
// https://github.com/liblit/WALA/issues/3
if (System.getProperty('os.name') == 'Mac OS X')
test.exclude '**/TestNativeTranslator.class'