This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: JvInitClass calls exit?
On 09/12/05, Andrew Haley <aph@redhat.com> wrote:
> You need to give us a reproducable test case. That is, you must say
> *exactly* how you built this.
>
> In addition, make sure you have read and understood this thread:
>
> http://gcc.gnu.org/ml/java/2005-12/msg00097.html
Ok, I can't say I completely understand the thread (I have no idea
what a PLT thunk is), but it looks like the gist of it is that it's
hard to mix java and c++ when using shared libraries. I'm actually
compiling statically at the moment (something I really should have
mentioned initially), so I'm not sure if this applies. What I did to
install the lucene library was:
# Get the library from
http://ftp.wayne.edu/apache/jakarta/lucene/source/lucene-1.4.3-src.tar.gz
tar xzvf lucene-1.4.3-src.tar.gz
patch -p0 < lucene.patch (the attachment to the previous email)
find lucene-1.4.3/src/java -name '*.java' > lucene.contents
mkdir -p lib
/opt/gcc-4.1/bin/gcj -c -o lib/liblucene.so @lucene.contents
/usr/bin/ar -r -v lib/liblucene.a lib/liblucene.so
mkdir -p include
/opt/gcc-4.1/bin/gcj -C -d include @lucene.contents
find include -name '*.class' -exec ./gcjh.sh {} \;
cp lib/liblucene* /opt/gcc-4.1/lib
cp -r include/org /opt/gcc-4.1/include
Where gcjh.sh runs gcjh on the class indicated by each .class file.
To compile my program (source in the previous email), I did
/opt/gcc-4.1/bin/g++ -static -fPIC -g -o main main.cpp -lgcj -llucene -lpthread
Which creates a statically-compiled executable that should open and
then close a lucene index. Instead, it looks like it dies attempting
to initialize the FSDirectory class. This behaviour is the same on
linux-2.6 and FreeBSD 5.3, if that matters any. Thanks for any help
you can give!
--jay