Trouble compiling swt.jar

View: New views
17 Messages — Rating Filter:   Alert me  

Trouble compiling swt.jar

by Ryan-17 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to compile swt.jar to swt.o so that I can make a native
Windows executable from Java source that uses SWT (3.1.1) as the
windowing toolkit.  When I try:
gcj -c swt.jar
I get several verification errors:

org/eclipse/swt/dnd/HTMLTransfer.java: In class
'org.eclipse.swt.dnd.HTMLTransfer':
org/eclipse/swt/dnd/HTMLTransfer.java: In method
'org.eclipse.swt.dnd.HTMLTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/HTMLTransfer.java:92: error: verification error at
PC=201
org/eclipse/swt/dnd/HTMLTransfer.java:92: error: might transfer control
into subroutine
org/eclipse/swt/dnd/RTFTransfer.java: In class
'org.eclipse.swt.dnd.RTFTransfer':
org/eclipse/swt/dnd/RTFTransfer.java: In method
'org.eclipse.swt.dnd.RTFTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/RTFTransfer.java:92: error: verification error at PC=201
org/eclipse/swt/dnd/RTFTransfer.java:92: error: might transfer control
into subroutine
org/eclipse/swt/dnd/TextTransfer.java: In class
'org.eclipse.swt.dnd.TextTransfer':
org/eclipse/swt/dnd/TextTransfer.java: In method
'org.eclipse.swt.dnd.TextTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/TextTransfer.java:114: error: verification error at
PC=377
org/eclipse/swt/dnd/TextTransfer.java:114: error: might transfer control
into subroutine
org/eclipse/swt/dnd/URLTransfer.java: In class
'org.eclipse.swt.dnd.URLTransfer':
org/eclipse/swt/dnd/URLTransfer.java: In method
'org.eclipse.swt.dnd.URLTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/URLTransfer.java:98: error: verification error at PC=208
org/eclipse/swt/dnd/URLTransfer.java:98: error: might transfer control
into subroutine
org/eclipse/swt/graphics/ImageLoader.java: In class
'org.eclipse.swt.graphics.ImageLoader':
org/eclipse/swt/graphics/ImageLoader.java: In method
'org.eclipse.swt.graphics.ImageLoader.load(java.lang.String)':
org/eclipse/swt/graphics/ImageLoader.java:149: error: verification error
at PC=40
org/eclipse/swt/graphics/ImageLoader.java:149: error: label part of
different subroutines
org/eclipse/swt/ole/win32/OleClientSite.java: In class
'org.eclipse.swt.ole.win32.OleClientSite':
org/eclipse/swt/ole/win32/OleClientSite.java: In method
'org.eclipse.swt.ole.win32.OleClientSite.saveToStorageFile(java.io.File)':
org/eclipse/swt/ole/win32/OleClientSite.java:1164: error: verification
error at PC=182
org/eclipse/swt/ole/win32/OleClientSite.java:1164: error: might transfer
control into subroutine

The version of gcj in use is:
$ gcj --version
gcj.exe (GCC) 4.0.2

Which I found on the thisiscool.com site.  I'm running Windows XP SP2
with cygwin.  Anybody have any ideas what I'm doing wrong?


Re: Trouble compiling swt.jar

by teddybear :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Exactly the same problem for me, except I tried swt 3.2M3... I'm not a gcj expert and I've no idea what are those verification errors... I would suggest using proguard to optimize all your libs alltogether. Hopefully it will get rid of those classes, that do not compile...

Re: Trouble compiling swt.jar

by Ranjit Mathew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ryan wrote:
> gcj -c swt.jar
> I get several verification errors:

[...]

> The version of gcj in use is:
> $ gcj --version
> gcj.exe (GCC) 4.0.2
>
> Which I found on the thisiscool.com site.  I'm running Windows XP SP2
> with cygwin.  Anybody have any ideas what I'm doing wrong?

The bytecode verifier used in this version of GCJ is known
to have many problems. You can either wait for 4.0.3 (or
4.1) or try a recent snapshot of either of these branches,
where we have moved to a better bytecode verifier.

Thanks,
Ranjit.

- --
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://ranjitmathew.hostingzero.com/


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDgYhkYb1hx2wRS48RApQdAKCki3Lgk1cyxH9MXawgDOjUDx9AAACeODaJ
/WEIVBLd/socx6TvRijkEgw=
=CwX5
-----END PGP SIGNATURE-----

Re: Trouble compiling swt.jar

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ranjit Mathew writes:
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 >
 > Ryan wrote:
 > > gcj -c swt.jar
 > > I get several verification errors:
 >
 > [...]
 >
 > > The version of gcj in use is:
 > > $ gcj --version
 > > gcj.exe (GCC) 4.0.2
 > >
 > > Which I found on the thisiscool.com site.  I'm running Windows XP SP2
 > > with cygwin.  Anybody have any ideas what I'm doing wrong?
 >
 > The bytecode verifier used in this version of GCJ is known
 > to have many problems. You can either wait for 4.0.3 (or
 > 4.1) or try a recent snapshot of either of these branches,
 > where we have moved to a better bytecode verifier.

Simply build with -findirect-dispatch.  That should do the trick.

Andrew.

Re: Trouble compiling swt.jar

by Ranjit Mathew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>  > > Which I found on the thisiscool.com site.  I'm running Windows XP SP2
>  > > with cygwin.  Anybody have any ideas what I'm doing wrong?
>  >
>  > The bytecode verifier used in this version of GCJ is known
>  > to have many problems. You can either wait for 4.0.3 (or
>  > 4.1) or try a recent snapshot of either of these branches,
>  > where we have moved to a better bytecode verifier.
>
> Simply build with -findirect-dispatch.  That should do the trick.

Right. More information in the Wiki:

http://gcc.gnu.org/wiki/How%20to%20BC%20compile%20with%20GCJ

I don't know if it works on Windows yet.

Thanks,
Ranjit.

--
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web: http://ranjitmathew.hostingzero.com/

Re: Trouble compiling swt.jar

by Nivox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Once upon a time Ryan wrote:
> I'm trying to compile swt.jar to swt.o so that I can make a native
> Windows executable from Java source that uses SWT (3.1.1) as the
> windowing toolkit.  When I try:
> gcj -c swt.jar
> I get several verification errors:
[CUT]

> The version of gcj in use is:
> $ gcj --version
> gcj.exe (GCC) 4.0.2

I've had the same problem. Try to compile this way:

gcj -c -fjni -findirect-dispatch swt.jar

then

gcj -c --classpath swt.jat YourSource.java
gcj --main=YourSource YourSource.o swt.o

This worked for me, the explanation for the -findirect-dispatch can be
found here:
http://gcc.gnu.org/wiki/How%20to%20BC%20compile%20with%20GCJ

I hpe this help.
Cheers Andrea
--
Nivox

Linux Registered User #290686
Powered by: Debian Testing/Unstable
JABBER: nivox@...
GPG Key ID: 0xC6A50D8D (info: www.gnupg.org)
GPG Keyserver: http://keyserver.linux.it




signature.asc (196 bytes) Download Attachment

Re: Trouble compiling swt.jar

by Ryan-18 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nivox wrote:

>Once upon a time Ryan wrote:
>  
>
>>I'm trying to compile swt.jar to swt.o so that I can make a native
>>Windows executable from Java source that uses SWT (3.1.1) as the
>>windowing toolkit.  When I try:
>>gcj -c swt.jar
>>I get several verification errors:
>>    
>>
>I've had the same problem. Try to compile this way:
>  
>
>gcj -c -fjni -findirect-dispatch swt.jar
>
>  
>

Thanks for the replies folks, the indirect-dispatch method seems to work
fine.  I had been avoiding it becuase I thought it required database
file generation and all that, but I guess that's not the case.  Not sure
why it solves the problem, but good enough for me!

Re: Trouble compiling swt.jar

by Andrew Haley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ryan writes:
 > Nivox wrote:
 >
 > >Once upon a time Ryan wrote:
 > >  
 > >
 > >>I'm trying to compile swt.jar to swt.o so that I can make a native
 > >>Windows executable from Java source that uses SWT (3.1.1) as the
 > >>windowing toolkit.  When I try:
 > >>gcj -c swt.jar
 > >>I get several verification errors:
 > >>    
 > >>
 > >I've had the same problem. Try to compile this way:
 > >  
 > >
 > >gcj -c -fjni -findirect-dispatch swt.jar
 > >
 > >  
 > >
 >
 > Thanks for the replies folks, the indirect-dispatch method seems to
 > work fine.  I had been avoiding it becuase I thought it required
 > database file generation and all that, but I guess that's not the
 > case.  Not sure why it solves the problem, but good enough for me!

We're sorry all this is so confusing.  At the present time there are
simply way too many ways to use gcj.  We intend to simplify gcj usage,
but this is all work in progress.

Andrew.

Re: Trouble compiling swt.jar

by Tom Tromey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>>> "Ranjit" == Ranjit Mathew <rmathew@...> writes:

>> Simply build with -findirect-dispatch.  That should do the trick.

Ranjit> Right. More information in the Wiki:
Ranjit> http://gcc.gnu.org/wiki/How%20to%20BC%20compile%20with%20GCJ
Ranjit> I don't know if it works on Windows yet.

Plain old '-findirect-dispatch' should work fine everywhere.  It
doesn't have any real platform dependencies, it just changes the
generated code to work a little differently.

Whether the class lookup database thing works, I don't know.  I
thought the .dll situation on the Windows port was still "not
working".

Tom


Re: Trouble compiling swt.jar

by teddybear :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> Plain old '-findirect-dispatch' should work fine everywhere.  It
> doesn't have any real platform dependencies, it just changes the
> generated code to work a little differently.
>
> Whether the class lookup database thing works, I don't know.  I
> thought the .dll situation on the Windows port was still "not
> working".
Please correct me if I'm wrong, but GCJ seems to ignore the flag in
version 3.4.4 (minGW original build). Not implemented? So for a windows
user not too much of help. I still get a bunch of compile-time errors
while compiling swt.jar :

gcj -c C:\TEMP\swt.jar -findirect-dispatch -fjni
org/eclipse/swt/dnd/HTMLTransfer.java: In class
`org.eclipse.swt.dnd.HTMLTransfer':
org/eclipse/swt/dnd/HTMLTransfer.java: In method
`org.eclipse.swt.dnd.HTMLTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/HTMLTransfer.java:92: error: verification error at
PC=201
org/eclipse/swt/dnd/HTMLTransfer.java:92: error: might transfer control
into subroutine
org/eclipse/swt/dnd/RTFTransfer.java: In class
`org.eclipse.swt.dnd.RTFTransfer':
org/eclipse/swt/dnd/RTFTransfer.java: In method
`org.eclipse.swt.dnd.RTFTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/RTFTransfer.java:92: error: verification error at PC=201
org/eclipse/swt/dnd/RTFTransfer.java:92: error: might transfer control
into subroutine
org/eclipse/swt/dnd/TextTransfer.java: In class
`org.eclipse.swt.dnd.TextTransfer':
org/eclipse/swt/dnd/TextTransfer.java: In method
`org.eclipse.swt.dnd.TextTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/TextTransfer.java:114: error: verification error at
PC=377
org/eclipse/swt/dnd/TextTransfer.java:114: error: might transfer control
into subroutine
org/eclipse/swt/dnd/URLTransfer.java: In class
`org.eclipse.swt.dnd.URLTransfer':
org/eclipse/swt/dnd/URLTransfer.java: In method
`org.eclipse.swt.dnd.URLTransfer.nativeToJava(org.eclipse.swt.dnd.TransferData)':
org/eclipse/swt/dnd/URLTransfer.java:98: error: verification error at PC=208
org/eclipse/swt/dnd/URLTransfer.java:98: error: might transfer control
into subroutine
org/eclipse/swt/graphics/ImageLoader.java: In class
`org.eclipse.swt.graphics.ImageLoader':
org/eclipse/swt/graphics/ImageLoader.java: In method
`org.eclipse.swt.graphics.ImageLoader.load(java.lang.String)':
org/eclipse/swt/graphics/ImageLoader.java:150: error: verification error
at PC=38
org/eclipse/swt/graphics/ImageLoader.java:150: error: might transfer
control into subroutine
org/eclipse/swt/ole/win32/OleClientSite.java: In class
`org.eclipse.swt.ole.win32.OleClientSite':
org/eclipse/swt/ole/win32/OleClientSite.java: In method
`org.eclipse.swt.ole.win32.OleClientSite.saveToStorageFile(java.io.File)':
org/eclipse/swt/ole/win32/OleClientSite.java:1164: error: verification
error at PC=182
org/eclipse/swt/ole/win32/OleClientSite.java:1164: error: might transfer
control into subroutine

with:

gcj --version
gcj.EXE (GCC) 3.4.4 (mingw special)
...

Please, can someone advise how to deal with this issue with this version
of gcc/gcj? It seems like some people are able to compile it. Currently,
I would be happy to work with v. 4.x but can't because of all the win32
problems in it... Have to fall back to the latest workable.

Thank you!!!

Michael.

Re: Trouble compiling swt.jar

by Tom Tromey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>>>>> "Michael" == Michael Baranov <michael.baranov@...> writes:

>> Plain old '-findirect-dispatch' should work fine everywhere.

Michael> Please correct me if I'm wrong, but GCJ seems to ignore the
Michael> flag in version 3.4.4 (minGW original build). Not
Michael> implemented?

Yes, this flag is a new addition in 4.0.

Michael> Please, can someone advise how to deal with this issue with
Michael> this version of gcc/gcj? It seems like some people are able
Michael> to compile it. Currently, I would be happy to work with
Michael> v. 4.x but can't because of all the win32 problems in
Michael> it... Have to fall back to the latest workable.

I'm afraid your options are pretty limited... you could hack the
verifier to ignore this error, or you could try to make 4.0 work.

Tom


Re: Trouble compiling swt.jar

by Mohan Embar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>I'm afraid your options are pretty limited... you could hack the
>verifier to ignore this error, or you could try to make 4.0 work.

Ironically, my 3.4 build has Tom's disable verifier hack:

http://www.thisiscool.com/gcc_mingw.htm#gcj34

P.S. My 4.02 build has integrated SWT 3138.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/





Re: Trouble compiling swt.jar

by teddybear :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!
> Ironically, my 3.4 build has Tom's disable verifier hack:
>
> http://www.thisiscool.com/gcc_mingw.htm#gcj34
>
> P.S. My 4.02 build has integrated SWT 3138.
Mohan, the case is that SWT 3138 is a little bit old for me. I'm using
the new opengl support introduced in eclipse's SWT 3.2M3... Itseems like
I need the 'disable verifier hack' (your build) to compile but I also
need the original libgcj (mingw original build) Just don't see an easy
solution :-( Having 4.x would make me happy... By the way, is there any
progress in fixing win32 you know about?

Thanks!

Michael.
P.S. would compiling from source instead of ready classes save me from
the verifier bug(s)?

Re: Trouble compiling swt.jar

by Mohan Embar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Michael,

>By the way, is there any progress in fixing win32 you know about?

What exactly is the list of deficiencies with 4.02? I know
you've mentioned them before, but I'm pretty distracted nowadays.

>P.S. would compiling from source instead of ready classes save me from
>the verifier bug(s)?

I think so. I build SWT from source for the 4.02 build without
the verifier hack and I think it built relatively okay.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/





Re: Trouble compiling swt.jar

by teddybear :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> What exactly is the list of deficiencies with 4.02? I know
> you've mentioned them before, but I'm pretty distracted nowadays.
>  
1) -findirect-dispatch (will save me half the lifetime :-) )
2) better bytecode verifier
3) newer libgcj (fully merged with classpath in 4.1?)
> P.S. would compiling from source instead of ready classes save me from
> the verifier bug(s)?
Any thoughts? I mean do you know of any activity to fix the win32 issues
for 4.x? Feels like it's close, and not too much left to fix...?

Michael.

Re: Trouble compiling swt.jar

by Mohan Embar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Michael,

>Any thoughts? I mean do you know of any activity to fix the win32 issues
>for 4.x? Feels like it's close, and not too much left to fix...?

I don't know of others who are currently working on Win32 libgcj stuff.
(I would like nothing more than to work on this day and night, but I'm
currently trying to get my freelance consulting business off the ground
and actually have to concentrate on projects which buy food and heat.)

Historically, I haven't had much luck in pulling newer libgcj trees into
older compiler versions. I've already mentioned my woes trying to get
4.1 to work on Win32. Unfortunately, I can't be of much help at the
present time. If you want to get involved in this yourself, there are a lot
of amazing people on this list.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/





Re: Trouble compiling swt.jar

by teddybear :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I've come across this:
    http://sourceforge.net/forum/forum.php?thread_id=1318931&forum_id=286533
and from there:
    http://hoeppie.gmxhome.de/SWT/

Hope this helps somebody.
Michael.