GCJ, Ant and packages?

Martin Egholm Nielsen martin@egholm-nielsen.dk
Mon May 24 16:38:00 GMT 2004


Hi there,

I'm trying to create an Ant-script for compiling my .java-files to 
.o-files using gcj. I've been inspired by Adam Megacz' build-script 
(http://gcc.gnu.org/ml/java/2002-11/msg00025.html), but it keeps failing.
In short, I have the single working source-file 
"src/some/pkg/TestClass.java" which I want to compile into the 
destination directory "out".
My build.xml file is given below.

The error is understandable:
=== SNIP ===
     [apply] Assembler messages:
     [apply] FATAL: can't create C:\DATA\1\out\some\pkg\TestClass.o: No 
such file or directory
=== SNIP ===
It's "bound" to fail since the package-directory does not exist. 
However, I don't quite see how in the world Adam's script could ever work?!

Does any of you have a working Ant/GCJ environment - e.g. with a 
homecooked gcj-anttask for compiling native objects.

Best regards,
  Martin Egholm

=== BUILD.XML ===

<?xml version="1.0"?>
<project name="gcj" default="build" basedir=".">
   <property name="OUTPUT" value="${basedir}/out" />

   <target name="build" depends="">

     <property name="INPUT" value="${basedir}/src" />

     <mkdir dir="${OUTPUT}"/>
     <!-- If I include the following it'll work -->
     <!-- mkdir dir="${OUTPUT}/some/pkg" /-->

     <apply failonerror='true' executable='gcj' dest="${OUTPUT}">
             <arg value='-O'/>
             <arg value='-g'/>
             <arg value='-c'/>
             <srcfile/>
             <arg value='-o'/>
             <targetfile/>
             <fileset dir='${INPUT}'>
                 <include name="some/pkg/TestClass.java"/>
             </fileset>
             <mapper type='glob' from='*.java' to='*.o'/>
     </apply>
   </target>
</project>




More information about the Java mailing list