Quick fix for broken hosted mode with Snow Leopard 10A380 on x86_64

31 views
Skip to first unread message

kugutsumen

unread,
Jun 20, 2009, 1:50:32 PM6/20/09
to Google Web Toolkit
This is going to become a real issue in September when Mac OS X 10.6
starts shipping.

Cross-compiling works but hosted mode is broken.

Darwin wolf 10.0.0b1 Darwin Kernel Version 10.0.0b1: Fri May 29
00:02:02 PDT 2009; root:xnu-1456~1/RELEASE_I386 i386

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java
-version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03-208)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-81, mixed mode)

GWT 0.0.0 At revision 5593.

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java
You must use a Java 1.5 runtime to use GWT Hosted Mode on Mac OS X.

If I skip the Java 1.5 test... UnsatisfiedLinkError is thrown.

On Mac OS X, ensure that you have Safari 3 installed.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to
load required native library 'gwt-ll'. Detailed error:
/Users/Shared/tank/pub/devel/gwt/gwt-mac-0.0.0/libgwt-ll.jnilib: no
suitable image found. Did find: /Users/Shared/tank/pub/devel/gwt/gwt-
mac-0.0.0/libgwt-ll.jnilib: no matching architecture in universal
wrapper)

$ file /Users/Shared/tank/pub/devel/gwt/gwt-mac-0.0.0/libgwt-ll.jnilib
/Users/Shared/tank/pub/devel/gwt/gwt-mac-0.0.0/libgwt-ll.jnilib: Mach-
O universal binary with 2 architectures
/Users/Shared/tank/pub/devel/gwt/gwt-mac-0.0.0/libgwt-ll.jnilib (for
architecture i386): Mach-O bundle i386
/Users/Shared/tank/pub/devel/gwt/gwt-mac-0.0.0/libgwt-ll.jnilib (for
architecture ppc): Mach-O bundle ppc

libgwt-ll.jnilib is prebuilt so adding -arch x86_64 to jni/mac/
Makefile has no effect.

I managed to get gwt hosted mode to work by patching isJava5 to
always return true:

--- ./dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java.orig
2009-06-21 00:42:40.000000000 +0700
+++ ./dev/mac/src/com/google/gwt/dev/BootStrapPlatform.java 2009-06-20
22:44:17.000000000 +0700
@@ -115,7 +115,7 @@
* 64-bit.
*/
private static boolean isJava5() {
- return System.getProperty("java.version").startsWith("1.5");
+ return true; /* System.getProperty("java.version").startsWith
("1.5"); */
}

/**

Then I hacked a 32bit only version of the 1.6 JRE by stripping the
x86_64 architecture:

cd /System/Library/Frameworks/JavaVM.framework/Versions
cp -pPR 1.6.0 1.6.0_32bit
cd !$
for bin in `find . -type f -exec file {} \; | grep 'Mach-O universal
binary with 2 architectures' | sed -e 's/:.*//' ` ; do ditto --rsrc --
arch i386 $bin $bin.tmp.app ; mv $bin.tmp.app $bin ; done

Added /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0_32bit/
Home in Eclipse -> Preferences -> Java -> Installed JRE and selected
it.

Really ugly fix but at least hosted mode works.

minichate

unread,
Jul 2, 2009, 10:05:15 PM7/2/09
to Google Web Toolkit
Thank you very much!

It is ugly, but it'll do until GWT itself is fixed. A note for others
trying this -- I believe some of the formatting got mangled in the
post. The last command should be:

for bin in `find . -type f -exec file {} \; | grep 'Mach-O universal
binary with 2 architectures' | sed -e 's/:.*//' ` ; do ditto --rsrc --
arch i386 $bin $bin.tmp.app ; mv $bin.tmp.app $bin ; done

Chris

pohl

unread,
Aug 2, 2009, 9:39:40 PM8/2/09
to Google Web Toolkit

> GWT 0.0.0 At revision 5593.

I noticed that you are using a trunk build of GWT here. Do you
believe this is a necessary step in getting this to work?

Also, does this mean that it is the new OOPHM that you got to work, or
the legacy hosted mode?



I just pre-ordered 10.6 today, and don't want my need to use GWT to
hold me back from upgrading. (Keeping my fingers crossed).

brett.wooldridge

unread,
Aug 3, 2009, 2:27:11 AM8/3/09
to Google Web Toolkit
Jesus Christ, you're considering hacking the Java6 binaries? Before I
got anywhere near that I would go with the new "Out Of Process Hosted
Mode". See http://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM

That's a million times simpler (and less sketchy) than hacking your
Java6 in OS X.

brett.wooldridge

unread,
Aug 3, 2009, 2:47:55 AM8/3/09
to Google Web Toolkit
Just as clarification, I use Java 6, 64-bit Eclipse Galileo, and OOPHM
on OS X 10.5.7.


On Aug 3, 3:27 pm, "brett.wooldridge" <brett.wooldri...@gmail.com>
wrote:
> Jesus Christ, you're considering hacking the Java6 binaries?  Before I
> got anywhere near that I would go with the new "Out Of Process Hosted
> Mode".  Seehttp://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM

kugutsumen

unread,
Aug 5, 2009, 10:56:13 AM8/5/09
to Google Web Toolkit

On Aug 3, 1:27 pm, "brett.wooldridge" <brett.wooldri...@gmail.com>
wrote:
> Jesus Christ, you're considering hacking the Java6 binaries?

The 32bit 1.6 JRE is just a separate JRE directory and I also needed
it
for others java applications that didn't work with 64bit 1.6.

 Before I
> got anywhere near that I would go with the new "Out Of Process Hosted
> Mode".  Seehttp://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM
>
> That's a million times simpler (and less sketchy) than hacking your
> Java6 in OS X.
>

OOPHM would be a more elegant solution but it was also broken when I
took a look at it
as you can see in my comments on that same page you posted (http://
code.google.com/p/google-web-toolkit/wiki/UsingOOPHM)

If OOPHM works now I'll surely give it a go. Did you use the GWT trunk
or the oophm branch?

kugutsumen

unread,
Aug 5, 2009, 10:58:38 AM8/5/09
to Google Web Toolkit
Oh you're using 10.5.7. I had no problem on my Leopard machine.
I might bug you later about getting OOPHM to work though.

johnw188

unread,
Aug 14, 2009, 12:15:35 PM8/14/09
to Google Web Toolkit
I had an easier solution, as I'm dual booting Leopard and Snow
Leopard. I simply copied over my Leopard Java 1.5 install to snow
leopard's /System/Library/Frameworks/JavaVM.framework/Versions/, added
the new library to Eclipse, and selected it in my GWT project.
Everything works great, as far as I can tell.

I know a bunch of people on snow leopard might not have a leopard
install handy, so I zipped my 1.5 directory. Just expand it to /System/
Library/Frameworks/JavaVM.framework/Versions/

http://files.me.com/johnwelsh/pn6hua

--John

Dustin Boling

unread,
Aug 18, 2009, 2:47:01 PM8/18/09
to Google Web Toolkit
Great workaround!

I dropped Java 1.5.0 into /System/Library/Frameworks/JavaVM.framework/
Versions/ replacing the existing 1.5.0 symlink.
Opened Eclipse > Preferences > Java > Installed JREs, and selected JVM
1.5.0
Rebuilt the project and it runs in hosted mode just fine.

Thanks!

Bruno

unread,
Sep 1, 2009, 10:17:26 AM9/1/09
to Google Web Toolkit

Thanks for the life saver.

Bruno
Reply all
Reply to author
Forward
0 new messages