ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guerry Semones" <>
Subject LD_LIBRARY_PATH problems using Ant to call C++ JNI code
Date Fri, 14 Jun 2002 17:07:23 GMT
This one is a bit convoluted to describe.  We are running a Freebsd unix
environment using Ant to control some building and testing.  In the case
where we're having problems, Ant is running C++ tests by having the Ant
script call "make test" to run the tests.  If we can resolve this issue,
then our build/test cycle will be fully automated on FreeBSD.

We are running: Ant 1.4.1 / JDK 1.3.1 / FreeBSD 4.5-RC

The build.xml target is:

<target name="test" description="Run all unit tests">
  <exec executable="/usr/local/bin/bash" failonerror="true" dir="myDir">
    <arg line="-c 'make test'" />

The LD_LIBRARY_PATH is set in the environment to have the following
JNI-required stuff:


To be concise, this is the way things are called, and then I'll state
the issue we are having:

1. Invoking "ant test" on the command line
   2. Ant calls "make test"
      3. Make calls C++ unit test (CppUnit)
         4. C++ code uses JNI to call JVM instance  <-- LD_LIBRARY_PATH
            5. JVM instance executes Java bytecode

The breakdown occurs at step #4.  For some reason, the LD_LIBRARY_PATH
is lost from the Ant environment (overwritten?) and Ant returns the
following error from the C++ unit test code:

     [exec] t10MyTest.testThisThing
     [exec] .Cannot open
"/usr/local/jdk1.3.1/jre/lib/i386//".Cannot open
6//".Cannot open
"/usr/local/jdk1.3.1/jre/lib/i386//"...............Cannot open
     [exec] .Cannot open "/usr/local/jdk1.3.1/jre/lib/i386//"F

If the test is executed WITHOUT Ant by using MAKE directly, then the
error does NOT occur:

1. Invoking "make test" on the command line
   2. Make calls C++ unit test (CppUnit)
      3. C++ code uses JNI to call JVM instance 
         4. JVM instance executes Java bytecode

Something in the Ant environment seems to be overwriting the
LD_LIBRARY_PATH.  I have tried putting the LD_LIBRARY_PATH settings into
every conceivable place I could conceive of :-).  For example, I've set
it in the following places:

-- in the shell environment
-- as parameters in the Makefile
-- as parameters in the Ant shell script that executes Ant
-- as an <env> tag in the Ant build script itself
-- each of these singly and together and several other convoluted things
I've tried....

Any ideas?  Thanks in advance!


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message