swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Java Compiler and Swarm


From: pauljohn
Subject: Re: GNU Java Compiler and Swarm
Date: Sat, 23 Jun 2001 01:00:34 -0500

I'm on your tracks now, friend.  Thanks for working out all these
details.  I know for sure I couldn't do it...

GCC 3.0 is finally built and installed, "seems to" compile swarm OK. I
rolled the swarmgcj.so build into the RPM setup, built fine, no errors.
Once I'm confident it is a working setup, I'll make rpms for gcc and
swarm available.  (I couldn't find any current rpms for gcc-3.0 on the
net, only prerelease snapshots). The only wrinkle I saw at the end of
the Swarm build were these 2 lines:
objdump: /tmp/swarm-root/usr/bin/javacswarm: File format not recognized
objdump: /tmp/swarm-root/usr/bin/javaswarm: File format not recognized
I don't know what the heck is up with that, but the installed files work
fine to compile java swarm and run java swarm the old fashioned way.

On my system, I did upgrade to fileutils-4.1-2 (because one document I
found in the Polish(ed) Linux Distribution said they couldn't get gcc to
compile without it, but other than that my system is pretty stock.  I
have the standard RedHat C library, binutils, etc.

I am able to run heatbugs from the swarmapps-2.1.1 package as well as
jheatbugs-2001-03-28.  The obj-c version of heatbugs seems incredibly
faster than it used to. I mean, on this PIII-667, it rips off 100 time
steps almost faster than I can move the control panel out from under a
graph and hit the stop button. 

Here are some numbers for comparison:

$ time ./heatbugs -b
<I'm snipping out a bunch of these because we've not patched gcc to get
rid of them>
/usr/bin/ld: warning: type and size of dynamic symbol
`__objc_class_name_SwarmObject' are not defined
You typed `heatbugs -b' or `heatbugs --batch', so we're running without
graphics.
Heatbugs is running for 300 timesteps.
It is logging data every 1 timesteps to: unhappiness.output.

real    0m7.765s
user    0m6.670s
sys     0m0.060s

The only change I made in that program source was to change the duration
to 300, so it would match the java model.  Same number of bugs, same
everything as far as I can see.

$ time javaswarm StartHeatbugs -b
You typed `heatbugs -b' or  `heatbugs --batch' so we're running without
graphics.
Heatbugs is running for 300 timesteps
It is logging data every 1 timesteps to: unhappiness.output
quitting at 300

real    0m46.094s
user    0m44.800s
sys     0m0.080s

I just don't think the disparity between objc and java was anywhere near
so great before.


Now, concerning the gcj compile using swarmgcj.so. This is where trouble
started.  I installed swarmgcj.so into /usr/lib/swarm with the other
shared libraries from swarm. Bad guess?  

I'm trying to figure out what to do about this part of your instruction,
where you say put this in the Makefile:
 
> model: $(SOURCES)
>         CLASSPATH=/build/swarm-jdk/java gcj -O2 -g --main=StartModel -o model 
> >$(SOURCES) /build/swarm-jdk/java/gcjswarm.so

Partly its a problem because my java apps do not have makefiles. 

So I decoded to see if I could make jheatbugs-2001-03-22 work. I made
its Makefile look like so:

JAVA_SRC = Heatbug.java HeatCell.java HeatSpace.java
HeatbugModelSwarm.java  HeatbugObserverSwarm.java StartHeatbugs.java
HeatbugBatchSwarm.java

all: $(JAVA_SRC)
        $(SWARMHOME)/bin/javacswarm $(JAVA_SRC)

clean:
        rm -f *.class

model: $(JAVA_SRC)
        CLASSPATH=$(SWARMHOME)/share/swarm/swarm.jar gcj -O2 -g
--main=StartHeatbugs -o model $(JAVA_SRC)
$(SWARMHOME)/lib/swarm/gcjswarm.so

$ make model
CLASSPATH=/usr/share/swarm/swarm.jar gcj -O2 -g --main=StartHeatbugs -o
model Heatbug.java HeatCell.java HeatSpace.java HeatbugModelSwarm.java 
HeatbugObserverSwarm.java StartHeatbugs.java HeatbugBatchSwarm.java 
/usr/lib/swarm/gcjswarm.so

$ ./model
Exception caught: javaswarm: file not found
Exception in thread "main" java.lang.AbstractMethodError: createBegin
   at 0x403e491a: _ZN4java4lang9ThrowableC1EPNS0_6StringE
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x403d9e7f: _ZN4java4lang5ErrorC1EPNS0_6StringE
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x403dc34f: _ZN4java4lang12LinkageErrorC1EPNS0_6StringE
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x403daeef:
_ZN4java4lang28IncompatibleClassChangeErrorC1EPNS0_6StringE
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x403d596f: _ZN4java4lang19AbstractMethodErrorC1EPNS0_6StringE
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x403affe6: _Jv_LookupJNIMethod (/usr/local/gcc3/lib/libgcj.so.2)
   at 0x4017afe7: _ZN5swarm21SwarmEnvironmentCImpl11createBeginEv
(/usr/lib/swarm/gcjswarm.so)
   at 0x4017be90: _ZN5swarm7Globals18__U3c_clinit__U3e_Ev
(/usr/lib/swarm/gcjswarm.so)
   at 0x403c6732: _ZN4java4lang5Class15initializeClassEv
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x404e000b: _Jv_InitClass (/usr/local/gcc3/lib/libgcj.so.2)
   at 0x080513ef: StartHeatbugs::main(JArray<java::lang::String*>*)
(/home/pauljohn/swarm/java/jheatbugs-2001-03-28/./StartHeatbugs.java:42)
   at 0x403c3537: _ZN3gnu3gcj7runtime11FirstThread3runEv
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x403ce442: _ZN4java4lang6Thread4run_EPNS0_6ObjectE
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x404dc765: _Z21_Jv_ThreadSetPriorityP12_Jv_Thread_ti
(/usr/local/gcc3/lib/libgcj.so.2)
   at 0x4070c693: GC_start_routine (/usr/local/gcc3/lib/libgcjgc.so.1)
   at 0x40725bfd: pthread_detach (/lib/i686/libpthread.so.0)
   at 0x4082d77a: __clone (/lib/i686/libc.so.6)

$ which javaswarm
/usr/bin/javaswarm
$ ldd ./model
        /usr/lib/swarm/gcjswarm.so => /usr/lib/swarm/gcjswarm.so
(0x40018000)
        libgcc_s.so.1 => /usr/local/gcc3/lib/libgcc_s.so.1 (0x4027c000)
        libgcj.so.2 => /usr/local/gcc3/lib/libgcj.so.2 (0x40284000)
        libm.so.6 => /lib/i686/libm.so.6 (0x406dc000)
        libgcjgc.so.1 => /usr/local/gcc3/lib/libgcjgc.so.1 (0x40700000)
        libpthread.so.0 => /lib/i686/libpthread.so.0 (0x4071f000)
        libz.so.1 => /usr/lib/libz.so.1 (0x40734000)
        libdl.so.2 => /lib/libdl.so.2 (0x40743000)
        libc.so.6 => /lib/i686/libc.so.6 (0x40747000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

What's really neat is I can start gcc ./model, but the output is the
same as the spat I gave above.

If I understood you properly before, this is not affected by the jdk,
but I'm using Sun's jdk-1.3.1, (which I have symlinked to jdk-1.3 for
continuity's sake).

If you try to guess what is wrong with my system, don't forget the
possibility that I could have made some obvious blunder in installing
gcc :)



"Marcus G. Daniels" wrote:
> 
> With today's Swarm snapshot, it is possible to build models using the
> (just released) native code GNU Java Compiler in GCC 3.0.  This is an
> advantage for several reasons:
......
> 
> Then, in your model, add a rule like this:
> 
> model: $(SOURCES)
>         CLASSPATH=/build/swarm-jdk/java gcj -O2 -g --main=StartModel -o model 
> $(SOURCES) /build/swarm-jdk/java/gcjswarm.so
> 
> StartModel would be the class having the `main' you want to run.
> 
> I know this works on Intel Linux, 

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]