* ecj1 in cross-compile
@ 2008-06-11 7:37 Matthijs van de Water
2008-06-11 8:35 ` Andrew Haley
0 siblings, 1 reply; 9+ messages in thread
From: Matthijs van de Water @ 2008-06-11 7:37 UTC (permalink / raw)
To: java
Hello,
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?
Regards,
Matthijs
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-06-11 7:37 ecj1 in cross-compile Matthijs van de Water
@ 2008-06-11 8:35 ` Andrew Haley
2008-06-11 16:32 ` David Daney
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Haley @ 2008-06-11 8:35 UTC (permalink / raw)
To: Matthijs van de Water; +Cc: java
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. Of course we can install an ecj1 binary if we're
compiling for the host machine, but that can't possibly work if we're
cross-compiling because there is no Java runtime on which ecj1 can run.
ecj1 can be a small shell script that invokes the compiler; I've
appended it.
Andrew.
cat ~/bin/ecj1
#!/bin/sh
gij -cp /home/aph/gcc/trunk/ecj.jar \
org.eclipse.jdt.internal.compiler.batch.GCCMain \
${1+"$@"}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-06-11 8:35 ` Andrew Haley
@ 2008-06-11 16:32 ` David Daney
2008-08-13 20:51 ` Daniel Andrzejewski
0 siblings, 1 reply; 9+ messages in thread
From: David Daney @ 2008-06-11 16:32 UTC (permalink / raw)
To: Andrew Haley; +Cc: Matthijs van de Water, java
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-06-11 16:32 ` David Daney
@ 2008-08-13 20:51 ` Daniel Andrzejewski
2008-08-14 10:08 ` Andrew Haley
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Andrzejewski @ 2008-08-13 20:51 UTC (permalink / raw)
To: java
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.
Is there anything I'm doing wrong? When I built gcc with --enable-shared and
without point to the ecj.jar, I was able to compile java programs, but they
of course needed the shared libraries, which I must avoid.
Please help.
Daniel Andrzejewski
--
Daniel Andrzejewski
student IT Administrator
Elec Engr & Comp Science
University of Tennessee
(865) 974 - 4388 (work)
"Investment in knowledge always pays the best interest"
Benjamin Franklin
--
--
View this message in context: http://www.nabble.com/ecj1-in-cross-compile-tp17771813p18970983.html
Sent from the gcc - java mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-08-13 20:51 ` Daniel Andrzejewski
@ 2008-08-14 10:08 ` Andrew Haley
2008-08-14 14:13 ` Daniel Andrzejewski
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Haley @ 2008-08-14 10:08 UTC (permalink / raw)
To: Daniel Andrzejewski; +Cc: java
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-08-14 10:08 ` Andrew Haley
@ 2008-08-14 14:13 ` Daniel Andrzejewski
2008-08-14 14:42 ` Andrew Haley
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Andrzejewski @ 2008-08-14 14:13 UTC (permalink / raw)
To: java
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-08-14 14:13 ` Daniel Andrzejewski
@ 2008-08-14 14:42 ` Andrew Haley
2008-08-14 15:40 ` Daniel Andrzejewski
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Haley @ 2008-08-14 14:42 UTC (permalink / raw)
To: Daniel Andrzejewski; +Cc: java
Daniel Andrzejewski wrote:
>
>
> 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.
In your gcc 4.3 build directory, type:
make check-target-libjava
Andrew.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-08-14 14:42 ` Andrew Haley
@ 2008-08-14 15:40 ` Daniel Andrzejewski
2008-08-14 16:11 ` Andrew Haley
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Andrzejewski @ 2008-08-14 15:40 UTC (permalink / raw)
To: java
Andrew Haley wrote:
>
> Daniel Andrzejewski wrote:
>>
>>
>> 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.
>
> In your gcc 4.3 build directory, type:
>
> make check-target-libjava
>
> Andrew.
>
>
Hi Andrew,
Thank you for your reply.
I'm going to try 'make check-target-libjava', but for now it looks like I
found the solution to my compilation problem:
export CLASSPATH=.:/home/scratch/daniel/:/sw/java-jdk/ecj.jar
~> /scratch/daniel> gcj --main=HelloWorld -o HelloWorld HelloWorld.java
~> /scratch/daniel> ./HelloWorld
Hello World!
Success! But ...
~> /scratch/daniel> file HelloWorld
HelloWorld: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
GNU/Linux 2.4.1, dynamically linked (uses shared libs), not stripped
~> /scratch/daniel> ldd HelloWorld
libm.so.6 => /lib64/tls/libm.so.6 (0x00002b1b953be000)
libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x00002b1b95515000)
librt.so.1 => /lib64/tls/librt.so.1 (0x00002b1b95629000)
libz.so.1 => /lib64/libz.so.1 (0x00002b1b95732000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b1b95845000)
libc.so.6 => /lib64/tls/libc.so.6 (0x00002b1b95948000)
/lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
(0x00002b1b952a7000)
I really need to build gcc with static libraries, so my final result would
look like this:
daniel@acai ~/mpi> ldd hello
not a dynamic executable
daniel@acai ~/mpi> file hello
hello: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
GNU/Linux 2.4.1, statically linked, for GNU/Linux 2.4.1, not stripped
What should I do? Do you have any suggestions?
Regards,
Daniel Andrzejewski
--
View this message in context: http://www.nabble.com/ecj1-in-cross-compile-tp17771813p18984135.html
Sent from the gcc - java mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ecj1 in cross-compile
2008-08-14 15:40 ` Daniel Andrzejewski
@ 2008-08-14 16:11 ` Andrew Haley
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Haley @ 2008-08-14 16:11 UTC (permalink / raw)
To: Daniel Andrzejewski; +Cc: java
Daniel Andrzejewski wrote:
>
> Hi Andrew,
>
> Thank you for your reply.
>
> I'm going to try 'make check-target-libjava', but for now it looks like I
> found the solution to my compilation problem:
>
> export CLASSPATH=.:/home/scratch/daniel/:/sw/java-jdk/ecj.jar
>
> ~> /scratch/daniel> gcj --main=HelloWorld -o HelloWorld HelloWorld.java
> ~> /scratch/daniel> ./HelloWorld
> Hello World!
I have not the slightest idea why that should make any difference. After
all, your ecj1 script set the classpath. But I never understood what was
causing your problem anyway.
> Success! But ...
>
> ~> /scratch/daniel> file HelloWorld
>
> HelloWorld: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
> GNU/Linux 2.4.1, dynamically linked (uses shared libs), not stripped
>
> ~> /scratch/daniel> ldd HelloWorld
> libm.so.6 => /lib64/tls/libm.so.6 (0x00002b1b953be000)
> libpthread.so.0 => /lib64/tls/libpthread.so.0 (0x00002b1b95515000)
> librt.so.1 => /lib64/tls/librt.so.1 (0x00002b1b95629000)
> libz.so.1 => /lib64/libz.so.1 (0x00002b1b95732000)
> libdl.so.2 => /lib64/libdl.so.2 (0x00002b1b95845000)
> libc.so.6 => /lib64/tls/libc.so.6 (0x00002b1b95948000)
> /lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
> (0x00002b1b952a7000)
>
>
> I really need to build gcc with static libraries, so my final result would
> look like this:
>
> daniel@acai ~/mpi> ldd hello
> not a dynamic executable
That path is fraught with pain and disaster. Java is inherently a dynamic
language and many components use runtime class lookup, so statically
linking fails. However, after a lot of difficulties some people on this
list have successfully statically linked with gcj; perhaps they can help you.
Andrew.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-08-14 16:11 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-11 7:37 ecj1 in cross-compile Matthijs van de Water
2008-06-11 8:35 ` Andrew Haley
2008-06-11 16:32 ` David Daney
2008-08-13 20:51 ` Daniel Andrzejewski
2008-08-14 10:08 ` Andrew Haley
2008-08-14 14:13 ` Daniel Andrzejewski
2008-08-14 14:42 ` Andrew Haley
2008-08-14 15:40 ` Daniel Andrzejewski
2008-08-14 16:11 ` Andrew Haley
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).