public inbox for
 help / color / mirror / Atom feed
* compiling antlr with gcj
@ 2003-07-11  1:00 paul taney
  2003-07-11  2:06 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: paul taney @ 2003-07-11  1:00 UTC (permalink / raw)
  To: rhug-rhats


This discussion is taking place on the antlr-interest
list.  A senior developer of antlr and I are engaged
in trying to compile antlr with gcj.  We have gotten
it to compile but are having link problems on

Could you please comment on the error we're getting?

We would appreciate it so much.  If you don't know,
antlr is an advanced parser generator at


---<what follows is from> ---


I have put the --classpath back into the script
and added this to that path:


because that's were gcc's Throwable lives.  And 
added ".o" to the -o arg (because it complained 
that antlr was a dir).

Now the $CLASSPATH is

and the compile script is:

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

Still we have:

/tmp/ccfeKrb0.o: In function
undefined reference to
undefined reference to
undefined reference to
undefined reference to
*> *)'

$ grep getCause $PATH/
  public Throwable getCause()
   * Then if <code>getCause()</code> doesn't return
null it adds a line
    Throwable cause = getCause();
        cause = cause.getCause();

Anybody have a clue?


--- lgcraymer <> wrote:
> All--
> Since Paul and I took this discussion offline (my
> role has been 
> mostly to interpret the compiler error messages
> while he does all the 
> real work), he has made some impressive progress. 
> After adding a few 
> type casts to the ANTLR source, all of ANTLR
> compiles and we appear to 
> be down to one link error--java.lang.Throwable
> methods cannot be 
> found.
> At this point, our best guess is that this is fixed
> in the version of 
> gcj used by RHUG
> (<>--they call for a 
> recent development snapshot) to get all of their
> Java projects to 
> compile (some of which are more demanding than
> ANTLR).  Unfortunately, 
> Paul is stuck with a slow connection and has a
> family emergency to 
> attend to, and I'm spending my spare time trying to
> prepare for this 
> weekend's discussions.  We won't be able to take the
> last small steps 
> for several days.  If anyone out there wants to
> produce an executable 
> sooner, you have our blessings.  I'll post his diffs
> and compilation 
> script (neither of us have yet looked into gcj
> makefiles) below.
> --Loring


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: compiling antlr with gcj
  2003-07-11  1:00 compiling antlr with gcj paul taney
@ 2003-07-11  2:06 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2003-07-11  2:06 UTC (permalink / raw)
  To: paul taney; +Cc: rhug-rhats

>>>>> "paul" == paul taney <> 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 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 at runtime.  The gcc project made a decision not
to have the compiler do this automatically; I don't remember why.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-11  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-11  1:00 compiling antlr with gcj paul taney
2003-07-11  2:06 ` Tom Tromey

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).