For completeness, I am using:

Apache Ant version 1.6.5 compiled on June 2 2005

java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Server VM (build 1.5.0_05-b05, mixed mode)



On 14/06/06, Juan Jimenez <[EMAIL PROTECTED]> wrote:

Back in June 2004 there was a thread briefly discussing the problem of
native libraries having dependencies on further native libraries and the
apparent lack of support in ANT to modify Path or LD_LIBRARY_PATH as
appropriate.  I am facing the problem (which I explain in more detail below)
and I am posting this in the hope that things have moved on or someone had a
bright idea on how to tackle this.

##### The Problem #####
I use Cruisecontrol to build several branches of several different
projects.  The build itself is done through ANT scripts which I have
refactored extensively to avoid duplication.  As such, all projects have a
standard location where they keep third party dependencies.  That includes
both jar files and natibe libraries (DLLs for Windows and SOs for RHEL-3).

Within the <junit> task I have included the following inner elements:

            <sysproperty key="java.library.path" path="${junit.lib.path
}"/>
            <sysproperty key="LD_LIBRARY_PATH" path="${ junit.lib.path}"/>
            <sysproperty key="PATH" path="${junit.lib.path}"/>

where junit.lib.path is set to a path structure that includes all project
specific dependencies (including DLLs and SOs).

Our Java code can find any native library it needs (be it DLL or SO).
However, if that native library tries to load further native libraries we
get an UnsatisfiedLinkError

Below is a sample stack trace showing that libIRTKJava.so cannot find
libIRTKApi.so even though they are both in the same directory:

java.lang.UnsatisfiedLinkError:
/vob/gcib/etrading/projects/PricingImpl/lib/package/libIRTKJava.so:
libIRTKApi.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method) at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751) at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676) at
java.lang.Runtime.loadLibrary0(Runtime.java:822) at
java.lang.System.loadLibrary(System.java:992) at
irtkjava.LibLoader.loadNativeLibrary(LibLoader.java:46) at
com.bofa.ib.pricer.impl.irtk.IRTKCurveBuilderTest.initialise(
IRTKCurveBuilderTest.java:21) at
com.bofa.ib.pricer.impl.irtk.IRTKCurveBuilderTest.setUp(
IRTKCurveBuilderTest.java:34)

Am I going to be forced to look into a nominated directory and preload
anything that matches *.so before invoking a non-forked JVM for the unit
tests?

Reply via email to