compilation problems with ecj.jar

Andrew Haley aph@redhat.com
Tue Jan 16 21:22:00 GMT 2007


Marco Trudel writes:
 > Andrew Haley wrote:
 > > The *real* cause is that, for some reason, gcj isn't being passed the
 > > correct path to libgcj.jar in the host system. Instead, this happens:
 > > 
 > > jc1 /mnt/zebedee/aph/gcc/trunk/libjava/.././libjava/../ecj.jar \
 > > -fhash-synchronization \
 > > -fno-use-divide-subroutine \
 > > -fuse-boehm-gc \
 > > -fnon-call-exceptions \
 > > -fkeep-inline-functions \
 > > -quiet \
 > > -dumpbase ecj.jar \
 > > -mtune=generic \
 > > -auxbase ecj \
 > > -g \
 > > -O2 \
 > > -version \
 > > -ffloat-store \
 > > -fomit-frame-pointer \
 > > -findirect-dispatch \
 > > -fbootclasspath=./:/tmp/prefix/share/java/libgcj-4.3.0.jar \
 > > -o /tmp/ccD80X4c.s
 > > 
 > > Note that the bootclasspath at this point is wrong: there's no
 > > libgcj.jar in the install dir yet. The first "./" item in the string
 > > is wrong because the .class files we need are no longer in the build
 > > dir: they're in the srcdir.
 > > 
 > > This oughta do it:
 > > 
 > > Index: Makefile.am
 > > ===================================================================
 > > --- Makefile.am	(revision 120638)
 > > +++ Makefile.am	(working copy)
 > > @@ -670,7 +670,7 @@
 > > ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) -Djava.class.path=$(ECJ_JAR)
 > > else !ENABLE_SHARED
 > > ## Use ecj.jar at compile time.
 > > -ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) $(ECJ_BUILD_JAR)
 > > +ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) $(ECJ_BUILD_JAR) -fbootclasspath=$(BOOTCLASSPATH)
 > > endif !ENABLE_SHARED
 > > 
 > > ecjx_LDADD = -L$(here)/.libs libgcj.la
 > > 
 > 
 > No, still the same:
 > /home/Marco/Desktop/compile-lin-lin/gcc-build/gcc/gcj 
 > -B/home/Marco/Desktop/compile-lin-lin/gcc-build/i686-pc-linux-gnu/libjava/ 
 > -B/home/Marco/Desktop/compile-lin-lin/gcc-build/gcc/ -ffloat-store 
 > -fomit-frame-pointer -g -O2 -o ecjx -findirect-dispatch 
 > --main=org.eclipse.jdt.internal.compiler.batch.GCCMain 
 > /usr/local/src/gcc/libjava/.././libjava/../ecj.jar 
 > -L/home/Marco/Desktop/compile-lin-lin/gcc-build/i686-pc-linux-gnu/libjava 
 > -L/home/Marco/Desktop/compile-lin-lin/gcc-build/i686-pc-linux-gnu/libjava/.libs 
 > ./.libs/libgcj.a 
 > -L/home/Marco/Desktop/compile-lin-lin/gcc-build/i686-pc-linux-gnu/libstdc++-v3/src 
 > -L/home/Marco/Desktop/compile-lin-lin/gcc-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs 
 > -lpthread -lrt -ldl 
 > -L/home/Marco/Desktop/compile-lin-lin/gcc-build/./gcc 
 > -L/home/Marco/Desktop/compile-lin-lin/gcc-XYZXYZ-lin/i686-pc-linux-gnu/bin 
 > -L/home/Marco/Desktop/compile-lin-lin/gcc-XYZXYZ-lin/i686-pc-linux-gnu/lib 
 > -lgcc -lc -lgcc
 > gcj: Internal error: Segmentation fault (program jc1)
 > Please submit a full bug report.
 > 
 > Maybe I patched the wrong Makefile.am? I patched the one in the libjava 
 > dir...
And you did run automake afterwards?
 > Another question: I noticed that ecj.jar is compiled at the end. How can 
 > then gcj compile all java sources before that? Is ecj.jar called by gij? 
 > Just thought about it and I'm curious...
 > > > BTW,l there are more problems with compiling ecj.jar for
 > > > cross-compiling. Creating a host-linux, target-windows GCJ will
 > > > create a ecj.exe what is definitely the wrong thing to do.
 > >
 > > It's the right thing to do. You have to build the ecj.exe for
 > > GNU/Linux as a separate step when building the GNU/Linux native
 > > compiler. If you don't want ecj.exe for the target, don't include
 > > ecj.jar in the build tree.
 > 
 > What do I need a "exe" for on Linux?
It's a Windows executable that compiles .java -> .class. If you're
going to compile Java source on Windows, you'll need it.
If you want to compile Java source on Linux, even if your target is
Windows, you must build a Linux *native* compiler to get ecj.exe.
 > If I create a gcj with host=Linux and target=Windows, I'd assume
 > that I get a "ecj" binary for Linux that compiles for Windows.
And you'd assume wrongly.
 > All other created binaries (gcc, gcj, objdump, ...) are also for
 > Linux and not exes.
gcj-dbtool? grmic? gjar? etc. All for the target machine.
 > If I get a ecj.exe, what can I do with it? I wont be able to
 > compile .java files on Linux and its useless on Windows as far as I
 > can see. But I'd be glad to learn better...
You need it for the Windows compiler.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /