ecj1 in cross-compile
Daniel Andrzejewski
mastadan@o2.pl
Thu Aug 14 14:13:00 GMT 2008
Andrew Haley wrote:
>> Daniel Andrzejewski wrote:
>>>>>> David Daney wrote:
>>> Andrew Haley wrote:
>>>> Matthijs van de Water wrote:
>>>>>>>>>>>>> I've got my GCC 4.3 toolchain working ok now, but for some reason I
>>>>> fail to get an ecj1 binary.
>>>>>>>>>> I'm cross-compiling for ARM and I've tried --with-ecj-jar=XXX (which
>>>>> doesn't result in an ecj1) and also tried putting ecj.jar in my build
>>>>> dir (which complains about a missing java compiler).
>>>>> I must be doing something wrong, but I'm not sure what.
>>>>>>>>>> I expect an i686 ecj1 binary to be compiled from the ecj-latest.jar
>>>>> that I download in my build. Preferably standalone, like the Ubuntu
>>>>> one.
>>>>> The build machine doesn't have an i686 GCJ or JAVAC installed, is that
>>>>> a problem?
>>>>>>>>>> What am I missing?
>>>>>>>>> I don't know how you think this is going to work. ecj1 is a Java
>>>> program
>>>> and thus it needs some sort of Java runtime library. You are going to
>>>> need
>>>> an i686 gcj installed.
>>> That's right. It is a new requirement for GCC-4.3 cross compilers.
>>> Either install a native build of gcj/libgcj in your PATH, or as Andrew
>>> suggested use the little shell script to invoke the jar file.
>>>>>> You have to be careful though, if you may not always want a native
>>> GCC-4.3 in your PATH, perhaps only when invoking the cross compiler.
>>> You could just copy or link the native ecj1 to the cross compiler bin
>>> directory.
>>>>>> David Daney
>>>>>>>>>>>>> Hi,
>>>> I have successfully compiled gcc-4.3.0. I need to cross-compile java code
>> to
>> binary executables which wouldn't need shared libraries. So, I used
>> options
>> like
>> --disable-shared
>> --enable-languages=java
>> --with-ecj-jar=/home/daniel/ecj.jar
>>>> Now, when I try to compile a java program I get the following error:
>>>> ~> gcj --main=HelloWorld -o HelloWorld HelloWorld.java
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org.eclipse.jdt.internal.compiler.batch.GCCMain
>> at gnu.java.lang.MainThread.run(MainThread.java:102)
>> Caused by: java.lang.ClassNotFoundException:
>> org.eclipse.jdt.internal.compiler.batch.GCCMain not found in
>> gnu.gcj.runtime.SystemClassLoader{urls=[file:./],
>> parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:529)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:442)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:377)
>> at gnu.java.lang.MainThread.run(MainThread.java:98)
>>>>>> I cannot figure out what to fix. I tried to move the existing ecj1 file,
>> and
>> that's what I got:
>>>> ~> gcj --main=HelloWorld -o HelloWorld HelloWorld.java
>>>> gcj: error trying to exec 'ecj1': execvp: Permission denied
>>>>>> It's understandable, I just renamed the ecj1 to something else.
>>>> Now, when I use a short bash script that is provided above, I get
>> different
>> error:
>>>> ~> gcj --main=HelloWorld -o HelloWorld HelloWorld.java
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org.eclipse.jdt.internal.compiler.batch.GCCMain
>> *** Got java.lang.NullPointerException while trying to print stack trace.
>> My bash script is:
>> #!/bin/sh
> gij -cp /home/aph/gcc/trunk/ecj.jar \
> org.eclipse.jdt.internal.compiler.batch.GCCMain \
> ${1+"$@"}
>> Andrew.
>>
So, I used your script, just made an adjustment to the path to ecj.jar file,
and as I mentioned earlier, I got this error:
Exception in thread "main" java.lang.NoClassDefFoundError:
org.eclipse.jdt.internal.compiler.batch.GCCMain
*** Got java.lang.NullPointerException while trying to print stack trace.
What should I fix? I seem to get stuck.
Thanks,
Daniel Andrzejewski
--
View this message in context: http://www.nabble.com/ecj1-in-cross-compile-tp17771813p18982303.html
Sent from the gcc - java mailing list archive at Nabble.com.
More information about the Java
mailing list