Building an app with gcj and readline

David N. Welton davidw@dedasys.com
Sat Oct 30 13:16:00 GMT 2004


Mark W. asked me to write and "complain" here a bit about the process
of building my app.

Basically, my app builds reasonably well with gcj, and it's not that
hard to figure out.  It's fairly similar to how I use gcc.

However, the problems start when I try and link the whole thing with
libreadline-java on my Debian (testing) system.  I eventually figured
things out with Mark's patient help on irc, and ended up with the
following:

librl.so: /usr/share/java/libreadline-java.jar
	gcj-3.4 -fjni -fPIC -shared -Wl,-soname,librl.so -o librl.so /usr/share/java/libreadline-java.jar

rlhecl: classes librl.so
	gcj-3.4 -g -o rlhecl --main=com.dedasys.hecl.RLHecl com/dedasys/hecl/*.class  -L. -lrl -I/usr/share/java/libreadline-java.jar

and to get it to run correctly, I had to set the LD_LIBRARY_PATH to
include not only the build directory (for "librl.so"), but
/usr/lib/jni

Some things that wouldn't have seemed natural to me to try:

1) -fjni - wouldn't have thunk of it myself.

2) -I/usr/share/java/libreadline-java.jar - didn't I already compile
    that into the shared lib?  Seems odd.

3) having to set LD_LIBRARY_PATH is a bit of a pain.  It would be nice
   for deployment if that weren't necessary.

Mark mentions that -Djava.library.path=/usr/lib/jni ought to make the
library path part go away, but I'll let him deal with that.

Anyway... I'm really not complaining - Mark asked me to write down
some notes on this stuff, so here they are.  I'm really quite happy to
have a free java system to use to hack on my project!

Thankyou for your time,
-- 
David N. Welton
Personal:                   http://www.dedasys.com/davidw/
Apache Tcl:                 http://tcl.apache.org/
Free Software:              http://www.dedasys.com/freesoftware/
Linux Incompatibility List: http://www.leenooks.com/



More information about the Java mailing list