public inbox for rhug-rhats@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: paul taney <paultaney@yahoo.com>
Cc: rhug-rhats@sources.redhat.com
Subject: Re: compiling antlr with gcj
Date: Fri, 11 Jul 2003 02:06:00 -0000	[thread overview]
Message-ID: <87fzldakqe.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20030711010043.21059.qmail@web80603.mail.yahoo.com>

>>>>> "paul" == paul taney <paultaney@yahoo.com> writes:

paul> Now the $CLASSPATH is
paul> /usr/local/gcc/gcc-3.3/libjava:\
paul> /usr/local/gcc/gcc-3.3/build/i686-pc-linux-gnu/libjava:\
paul> /usr/local/gcc/gcc-3.3/libjava/java/lang:\
paul> /usr/local/java/j2sdk1.4.2:\
paul> /usr/local/java/j2sdk1.4.2/bin:\
paul> /usr/local/jython-2.1:.

Let's talk about this a bit.
Why do you have all these things in CLASSPATH?

In general, don't put the JDK stuff in the class path.
Second, you shouldn't need to tell gcj where to find the default
classes -- it should find them by itself.

If you really need to do something like this, point gcj at the
installed libgcj-<version>.jar file.  It is in <prefix>/share/java,
where <prefix> depends on how you configured gcc.

paul> gcj --classpath $CLASSPATHGNU -o antlr.o --main=Tool \
paul>          antlr/*.java \
paul>          antlr/actions/cpp/*.java \
paul>          antlr/actions/csharp/*.java \
paul>          antlr/actions/java/*.java \
paul>          antlr/build/*.java \
paul>          antlr/collections/*.java \
paul>          antlr/collections/impl/*.java \
paul>          antlr/debug/*.java \
paul>          antlr/preprocessor/*.java

I recommend naming the output file "antlr" instead of "antlr.o".
This shouldn't matter, but it is weird and a little confusing.

Finally, gcj links with the libgcj.so library.  Make sure you are
linking against the right one.  This is probably your problem.

My guess is that, since you installed gcc in a non-standard location,
the linker is finding the wrong libgcj.  Link with "gcj -v" to see
what is going on.

I usually link like this:

gcj -o foo ... -Wl,-rpath,<prefix>/lib

This is an ugly hack to make the resulting executable find the
resulting libgcj.so at runtime.  The gcc project made a decision not
to have the compiler do this automatically; I don't remember why.

Tom

      reply	other threads:[~2003-07-11  2:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-11  1:00 paul taney
2003-07-11  2:06 ` Tom Tromey [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fzldakqe.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=paultaney@yahoo.com \
    --cc=rhug-rhats@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).