This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Success building Berkeley DB's Java [JNI] API with gcj


This is preliminary (and crude), but using gcj I was able to link the
Java API files from DB 4.2, as follows [Training \ characters omitted
for clarity]:

First, build the Java API into a .o:

	$ CLASSPATH=java/src:.
	  gcj
		-fjni
		-o dbjava.o
		-c `find java/src -name '*.java' | grep -v debug`

Then use that .o when building one of the examples that comes with DB:

	$ CLASSPATH=java/src:examples_java/src
	  gcj
		-fjni
		-o AccessExample
		--main=com.sleepycat.examples.bdb.access.AccessExample
		examples_java/src/com/sleepycat/examples/bdb/access/AccessExample.java
		dbjava.o

Then

	$ ./AccessExample

ran fine, creating a dbenv, and writing to db files!

[I also built the original .o as a .so with -shared, and it seemed to
work fine as well]

This result was with Berkely DB 4.2.52_p2 on a Gentoo Linux system with
GCC 3.3.2. The code involved is a JNI based API that wraps conventional
DB. Interestingly, their JNI is generated by something called 

[Note Sleepycat also has something they've just about finalized called
"Java Edition", but it would seem that that relies on J2SE 1.4.2
features (the ripped off log4j at least); in any case gcj couldn't build
the je.jar that makes up that version]

As I said, this is *very* preliminary, but the fact that it didn't bomb
messily is very encouraging! Before this can really be a conclusive
success I need to figure out how to run Berkeley DB's test suite;
sleepycat guys say its a bit tricky. I'm not exactly a toolchain ninja,
so I'm close to being in over my head.

Nevertheless, I'm pretty pleased that the option to use GCJ to build
native binaries that include Berkeley DB appears open!

AfC
Sydney

[edit version of original post to comp.databases.berkeley-db. People
still use Usenet - remarkable]

-- 
Andrew Frederick Cowie
Operational Dynamics Consulting Pty Ltd

Australia: +61 2 9977 6866  North America: +1 646 472 5054

http://www.operationaldynamics.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]