jc1 out of memory error gcc 4.2.2 Linux 64-bit OS
Andrew Haley
aph@redhat.com
Thu Jan 17 17:55:00 GMT 2008
[ Redirected to java@gcc.gnu.org ]
Harpal Grover wrote:
> Thanks to everyone for their kind help and advice. I tried Andrew's
> advice out as noted above, and it worked! I was finally able to
> generate a windows executable on 64 bit processors . On another note,
> I had to process all my classes as class files and not as java files
> for this to work. There is one last issue, of which I have a feeling
> may not be a big issue. When I double click on my executable, I get
> the following stacktrace printed out to a command prompt window:
>> Exception in thread "main" java.lang.NoClassDefFoundError: main.App
> at java.lang.Class.initializeClass(/datal/gcc/gcc/gcc/libgcc2.c:0)
> Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Listener no
> t found in gnu.gcj.runtime.SystemClassLoader{urls=[file:.\], parent=gnu.gcj.runt
> ime.ExtensionClassLoader{urls=[], parent=null}}
> at java.net.URLClassLoader.findClass(/datal/gcc/gcc/libjava/java/net/URLClass
> Loader.java:1080)
> at java.lang.ClassLoader.loadClass(/datal/gcc/gcc/libjava/java/lang/ClassLoad
> er.java:351)
> at java.lang.ClassLoader.loadClass(/datal/gcc/gcc/libjava/java/lang/ClassLoad
> er.java:295)
> at java.lang.VMClassLoader.defineClass(/datal/gcc/gcc/libjava/classpath/java/
> io/Writer.java:187)
> at java.lang.ClassLoader.defineClass(/datal/gcc/gcc/libjava/java/lang/ClassLo
> ader.java:483)
> at java.security.SecureClassLoader.defineClass(/datal/gcc/gcc/libjava/classpa
> th/java/security/SecureClassLoader.java:108)
> at java.net.URLClassLoader.findClass(/datal/gcc/gcc/libjava/java/net/URLClass
> Loader.java:1171)
> at java.lang.ClassLoader.loadClass(/datal/gcc/gcc/libjava/java/lang/ClassLoad
> er.java:351)
> at java.lang.ClassLoader.loadClass(/datal/gcc/gcc/libjava/java/lang/ClassLoad
> er.java:295)
> at java.lang.Class.initializeClass(/datal/gcc/gcc/gcc/libgcc2.c:0)
>Maybe you didn't compile your program with -g ? Do so.
> It looks like it is not able to find or load the swt library i use for
> my app. I have compiled, and linked the swt jar to the executable, and
> the corresponding swt dll is in the same directory where my executable
> is located. The following line below is used to generate my
> executable:
>> gcj -O -fjni -findirect-dispatch "--classpath=
> C:/lib/x1.jar;C:/lib/x2.jar" --main=main.App -o scnlm.exe y1.class
> y2.class -LC:/projects/java/TSCN/Desktop/3232 -lswt -lswt-win32-3232
>> Note all of the jars have been compiled into libswt, including swt.jar
>>This can be really painful. Sometimes, things are looked up by name
(i.e. strings rather than symbols) so things don't get linked in.
You can solve this with
--whole-archive
For each archive mentioned on the command line after the
--whole-archive option, include every
object file in the archive in the link, rather than searching
the archive for the required
object files. This is normally used to turn an archive
file into a shared library, forcing
every object to be included in the resulting shared library.
This option may be used more
than once.
Two notes when using this option from gcc: First, gcc
doesn't know about this option, so you
have to use -Wl,-whole-archive. Second, don't forget to use
-Wl,-no-whole-archive after your
list of archives, because gcc will add its own list of
archives to your link and you may not
want this flag to affect those as well.
Andrew.
More information about the Java
mailing list