compilation problems with ecj.jar

Marco Trudel mtrudel@gmx.ch
Sat Jan 20 12:01:00 GMT 2007


Tom Tromey wrote:
>>>>>> "Marco" == Marco Trudel <mtrudel@gmx.ch> writes:
> 
>>> GCJ_FOR_ECJX="${with_cross_host}-gcj"
> 
> Marco> Yes, this is what I would expect. With my host=Linux, target=minGW and
> Marco> build=Linux, it evaluates to "i686-pc-linux-gnu-gcj".
> 
> Ok...  you are building an "ordinary" cross compiler, not a Canadian
> cross.
> 
> So, we want to end up with an ecj1 which runs on your host machine
> (linux).  So we pick i686-pc-linux-gnu-gcj... should be correct.

Yes, I think too. But at least two other people told me otherwise. So 
there seems to be some confusion...


> Marco> i686-pc-linux-gnu-gcj -o ecjx.exe -findirect-dispatch
> Marco> --main=org.eclipse.jdt.internal.compiler.batch.GCCMain
> Marco> /usr/local/src/gcc/libjava/.././libjava/../ecj.jar
> 
> What version of i686-pc-linux-gnu-gcj is this?

Of course the most recent. All my compilers are the current trunk.


> Using '-findirect-dispatch --main=...', as in the above, is a new
> feature first introduced on the gcj-eclipse branch.  So, for this to
> work you will want a native linux gcc 4.3 first.
> 
> 
> Offhand though the errors you are seeing look more like a bad install
> of gcj.  I was surprised that it worked... did you try compiling a
> .java file to an executable?  "Hello world" should do.

Yes, the gcj is ok and works.


> Finally, I think the code to pick host_exeext in configure.ac is
> wrong.  It defaults to $ac_exeext -- but this is the target value.
> The appended is an untested patch which may help.  The idea is to
> default to nothing, and use $with_cross_host for crosses, and $host
> for natives.

Yes, that makes sense. But it only fixes (not tested) the wrong 
extension. The main problem, that the compilation of ecj.jar itself 
fails, remains. I now tried that manually again. Here with the default 
compilation that happens during make:

i686-pc-linux-gnu-gcj -o ecj-out -findirect-dispatch 
--main=org.eclipse.jdt.int ernal.compiler.batch.GCCMain ecj.jar
/tmp/ccKpOwei.o: In function `main':ccBUR1ih.i:(.text+0x30): undefined 
reference to `JvRunMainName'
/tmp/ccEr3pvj.o: In function `void 
org::eclipse::jdt::internal::compiler::classfmt::ClassFormatException::printStackTrace(java::io::PrintStream*)':ecj. 
jar:(.text+0x155dfc): undefined reference to `_Jv_MonitorExit'
:ecj.jar:(.text+0x155e4c): undefined reference to `_Jv_MonitorExit'
/tmp/ccEr3pvj.o: In function `void 
org::eclipse::jdt::internal::compiler::classfmt::ClassFormatException::printStackTrace(java::io::PrintWriter*)':ecj. 
jar:(.text+0x1561ec): undefined reference to `_Jv_MonitorExit'
:ecj.jar:(.text+0x15623c): undefined reference to `_Jv_MonitorExit'
/tmp/ccEr3pvj.o: In function `java::lang::Object* 
org::eclipse::jdt::internal::compiler::util::Messages$MessagesProperties::put(java::lang::Object*, 
ja va::lang::Object*)':ecj.jar:(.text+0x6643cd): undefined reference to 
`_Jv_MonitorExit'
/tmp/ccEr3pvj.o:ecj.jar:(.text+0x6643ec): more undefined references to 
`_Jv_MonitorExit' follow
/tmp/ccEr3pvj.o: In function `global constructors keyed to 
0__ZN3org7eclipse3jdt4core8compiler13CharOperation18__U3c_clinit__U3e_EJvv':ecj.jar:(.text+0 
x803e80): undefined reference to `_Jv_RegisterResource'
:ecj.jar:(.text+0x803e8c): undefined reference to `_Jv_RegisterResource'
:ecj.jar:(.text+0x803e98): undefined reference to `_Jv_RegisterResource'
:ecj.jar:(.text+0x803ea4): undefined reference to `_Jv_RegisterResource'
:ecj.jar:(.text+0x803eb0): undefined reference to `_Jv_RegisterResource'
/tmp/ccEr3pvj.o:ecj.jar:(.text+0x803ebc): more undefined references to 
`_Jv_RegisterResource' follow
collect2: ld returned 1 exit status

And here without "-findirect-dispatch":
i686-pc-linux-gnu-gcj -o ecj-out 
--main=org.eclipse.jdt.internal.compiler.batch.GCCMain ecj.jar

It works! Somehow -findirect-dispatch brings problems. But I really 
don't know what it could be...


Marco


> Tom
> 
> Index: configure.ac
> ===================================================================
> --- configure.ac	(revision 120901)
> +++ configure.ac	(working copy)
> @@ -293,7 +293,7 @@
>  
>  # Which gcj and host gcj (for ecjx) do we use?
>  which_gcj=default
> -host_exeext=${ac_exeext}
> +host_exeext=
>  GCJ_FOR_ECJX=
>  built_gcc_dir="`cd ${builddotdot}/../../${host_subdir}/gcc && ${PWDCMD-pwd}`"
>  if test -n "${with_cross_host}"; then
> @@ -320,6 +320,12 @@
>       which_gcj=cross
>    fi
>  else
> +  case "${host}" in
> +     *mingw* | *cygwin*)
> +         host_exeext=.exe
> +     ;;
> +  esac
> +
>    # We are being configured with a native or crossed-native compiler
>    if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
>       if test x"$build" = x"$host"; then
> 



More information about the Java mailing list