Fractal Softworks Forum

Starsector => Bug Reports & Support => Topic started by: Mossdog on August 03, 2012, 04:00:05 PM

Title: Mac Download
Post by: Mossdog on August 03, 2012, 04:00:05 PM
I think the Mac Download may be corrupt.  Only 27.1 megs instead of the 60 something for linux and windows.  Also... my mac says it is after three re downloads.
Title: Re: Mac Download
Post by: Alex on August 03, 2012, 05:03:58 PM
Hi Mossdog,

First off, sorry about the trouble - you're the 2nd person to have an issue like this, so let's see if we can get it sorted out. The Mac download is indeed smaller because it doesn't need to include certain things that the Windows and Linux ones do, and the app bundle isn't corrupt - so these aren't the problem, but something clearly is.

Would you mind downloading these two builds and telling me if either of them works for you?

Build one (https://s3.amazonaws.com/fractalsoftworks/starfarer/release/starfarer_mac-0.53a-test-info.zip)

Build two (https://s3.amazonaws.com/fractalsoftworks/starfarer/release/starfarer_mac-0.53a-test-stub.zip)

I'd really appreciate it if you would try both and let me know.
Title: Re: Mac Download
Post by: Mossdog on August 03, 2012, 08:28:04 PM
Build one gives me the same error about it being a corrupt file.
Build two gives me some security issues that I have to work around.  (I have Mountain Lion which apparently ruins everything)  When I work around the security issues and open it, the app makes like it is opening, but nothing happens.
OSX 10.8
2.26Ghz Intel Core 2 Duo
8GB 1067 MHz DDR3
13" Macbook Pro (Mid-2009 Edition)
Title: Re: Mac Download
Post by: Alex on August 03, 2012, 08:37:07 PM
Thanks for trying these. Can you try this with the 2nd version?

(Assuming Starfarer is in the Applications folder, if not, adjust path accordingly).

Open up Terminal and run these two commands:
cd /Applications/Starfarer.app/Contents/MacOS
./JavaApplicationStub


Normally, that would run the game - but since it'll fail, I'm interested in what the output of that is.


Also (and this may actually be more fruitful): take a look here (http://osxdaily.com/2012/08/01/install-java-in-os-x-mountain-lion/) - you might not actually have Java installed, as apparently Mountain Lion uninstalls it as part of the upgrade. If this is the case, could you try installing Java (per instructions in that link) and running all three of the builds to see what they do?

Sorry to ask you to do all these things, and thank you for helping/being willing to try stuff. I really appreciate it.

Title: Re: Mac Download
Post by: Mossdog on August 03, 2012, 10:19:06 PM
Followed the link instructions, I have Java 1.6 Installed.  (Needed it for an earlier program that Mountain Lion messed up.)

Here is the response to the other commands:
[JavaAppLauncher Warning] Java application launched from bad stub. Relaunching in 32-bit, and tagging sub-processes to prefer 32-bit with $JAVA_ARCH=i386.
[JavaAppLauncher Error] This process is [i386] and was re-exec'd from [i386], but for some reason we are trying re-exec to [].
[JavaAppLauncher Error] unable to find a version of Java to launch
Nicholas-Barabachs-MacBook-Pro:MacOS masakari161$
Title: Re: Mac Download
Post by: elZorro on August 04, 2012, 02:29:55 AM
I'm having the same problem, and tried the terminal commands with the second build yielding exactly the same output. I also have Java 1.6 installed.
Unfortunately I deleted my old versions of Starfarer, and had not played it since I installed Mountain Lion, so I'm not sure if its just a problem with this build or related to the 10.8 upgrade.
Title: Re: Mac Download
Post by: Alex on August 04, 2012, 08:31:13 AM
Thanks for giving it a shot, guys.

Some information that would be really handy to have, if you don't mind (type these three commands in terminal, one at a time, and let me know what the output is):

java -d64 -version
java -version
uname -a



To further try to fix it:

cp /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub /Applications/Starfarer.app/Contents/MacOS


And then, like before:

cd /Applications/Starfarer.app/Contents/MacOS
./JavaApplicationStub


(Again, changing the path to starfarer however appropriate).

If that doesn't work:

Build three (https://s3.amazonaws.com/fractalsoftworks/starfarer/release/starfarer_mac-0.53a-test-arch.zip)
Title: Re: Mac Download
Post by: Mossdog on August 04, 2012, 04:02:12 PM
First Command:
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
Second Command:
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
Third Command:
Darwin (*My Name*)-MacBook-Pro.local 12.0.0 Darwin Kernel Version 12.0.0: Sun Jun 24 23:00:16 PDT 2012; root:xnu-2050.7.9~1/RELEASE_X86_64 x86_64
Title: Re: Mac Download
Post by: Mossdog on August 04, 2012, 04:05:57 PM
I did not have to go to build three, the lines of text (that mean little to me) seemed to work.  Awesome, thanks Alex.
Title: Re: Mac Download
Post by: Alex on August 04, 2012, 10:00:33 PM
Cool - glad you got it working, and thanks for posting the output there!

Now, if I can impose on you once again: could you email me the file found at /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub on your system? My email is fractalsoftworks [at] gmail [dot] com.
Title: Re: Mac Download
Post by: elZorro on August 05, 2012, 12:57:55 AM
I decided to skip right to the third build and that works as well. Thanks for the help! I'll email that file to you momentarily.
Title: Re: Mac Download
Post by: Alex on August 05, 2012, 08:02:39 AM
Thanks for sending that - not to sound ungrateful, but would you mind trying the manual steps with build two? As it stands, I don't actually know that the file you've sent me would work on your system, since it hasn't been tried.
Title: Re: Mac Download
Post by: elZorro on August 05, 2012, 10:26:46 PM
Oh, sorry about that! I should have read those terminal commands more carefully.

First Command:
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)

Second Command:
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)

Third Command:
Darwin Nathans-MacBook-Pro.local 12.0.0 Darwin Kernel Version 12.0.0: Sun Jun 24 23:00:16 PDT 2012; root:xnu-2050.7.9~1/RELEASE_X86_64 x86_64

Then I put in the other commands and Starfarer opened successfully.
Do you need me to send the file again now?
Title: Re: Mac Download
Post by: Alex on August 06, 2012, 08:06:53 AM
Thank you for doing that - no, you don't need to resend the file.

Just to confirm: did you run this command, too?
cp /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub /Applications/Starfarer.app/Contents/MacOS

And if you did, is Starfarer in your Applications folder?
Title: Re: Mac Download
Post by: cardgame on August 06, 2012, 08:12:45 AM
Running 10.7 here still, just wanted to let you know .53 is working fine from here. The download also behaved normally (from Chrome).
Title: Re: Mac Download
Post by: elZorro on August 06, 2012, 05:26:29 PM
Yes, I did, and yes, Starfarer is in my Applications folder.
Title: Re: Mac Download
Post by: Mossdog on August 06, 2012, 05:30:58 PM
Sent you my file Alex.
Title: Re: Mac Download
Post by: Alex on August 06, 2012, 05:33:30 PM
Thank you, guys - I really appreciate it!
Title: Re: Mac Download
Post by: Mossdog on August 06, 2012, 05:43:01 PM
Any way to turn off all the debugging so that I can't infinite zoom out, and see whenever an enemy fleet loses a ship?
Title: Re: Mac Download
Post by: Alex on August 06, 2012, 05:47:26 PM
Use this build:
https://s3.amazonaws.com/fractalsoftworks/starfarer/release/starfarer_mac-0.53a-test-arch.zip

Or edit data/config/settings.json (using TextEdit) and set devMode:"false" up near the top.
Title: Re: Mac Download
Post by: Mossdog on August 06, 2012, 06:36:05 PM
cool, it worked.  (changing devmode to false.) thanks, I appreciate all the work to get this working for me.
Title: Re: Mac Download
Post by: brian on August 07, 2012, 11:23:20 PM
More and more people are upgrading to 10.8, and with the default security settings, will only get a "Move to Trash" button with the build that's on the front page. If you've figured out what's wrong, you might wanna put up the fixed binary on the blog's release post.
Title: Re: Mac Download
Post by: Alex on August 08, 2012, 08:18:28 AM
Hi brian,

Thanks for the heads up - I had updated the preorder page, but forgot to update the blog post (updated now).

Question: are you certain the issue is related to the security settings? Rather, are you able to run the original build with App Signing disabled?

I'm asking because the new build (found here (https://s3.amazonaws.com/fractalsoftworks/starfarer/release/starfarer_mac-0.53a-test-arch.zip)) doesn't change anything related to security - it simply runs using a different architecture setting - and yet, seems to work for people that had trouble running the original.

Any more info you could be provide would be really appreciated.
Title: Re: Mac Download
Post by: elZorro on August 09, 2012, 05:08:55 PM
10.8 doesn't make it obvious how to open applications from "unidentified developers," but all that has to be done is right click on the application, select "open," and hit yes. After that you will be able to open it again without a problem.
Title: Re: Mac Download
Post by: brian on August 12, 2012, 08:39:58 PM
Question: are you certain the issue is related to the security settings? Rather, are you able to run the original build with App Signing disabled?

There are 4 relevant states you could end up in when trying to launch an app on OS X 10.8.

1. The app launches without any messages.

2. Gatekeeper warns you that an app is unsigned, but allows you to open it anyway. You get a "cancel" and "open" button.

3. Gatekeeper blocks the app because it is unsigned. You get a "cancel" and "move to trash" button. This can by bypassed by right clicking on the executable and clicking Open, which results in state 2.

4. Gatekeeper fubars with a message saying <appname> is damaged and can't be opened, followed by a "cancel" and a "move to trash" button. This will not be bypassed by right clicking and selecting open.

----

The when we launch Starfarer for the first time with Gatekeeper set to Allow applications downloaded from: Mac App Store and identified developers (10.8 default setting), we're supposed to get (3), which can be bypassed by right clicking. We don't. Instead, we're getting (4).

Changing the Gatekeeper setting to Allow applications downloaded from: Anywhere causes (2) when attempting to launch Starfarer for the first time. Launches after that result in (1), which is the expected behaviour because Gatekeeper only applies to the first run of an executable. Changing Gatekeeper back to the anally retentive Allow applications downloaded from: Mac App Store and identified developers setting still allows Starfarer to be launched afterwards, because the executable has now been marked "safe" by Gatekeeper.

The updated build fails to launch with a (3) with Gatekeeper strict, and launches with a (2) with Gatekeeper relaxed, which is the appropriate behaviour for an unsigned app.

Hope that helps.

---edit---

Would changes precisely did you make to the app? I'm asking because if you really did simply change the architecture setting, then this is possibly a bug on Apple's side. I'm a Mac and iOS developer, and I'd like to go file a bug report with them if that's really the case.
Title: Re: Mac Download
Post by: Alex on August 12, 2012, 09:36:54 PM
Thanks for the info.

Hmm. It does sound like an issue with Gatekeeper.

The original 0.53a distribution had an x86_64 version of JavaApplicationStub (an executable that's used to launch Java - provided by Apple, found with Apple's Java distributions). It also had instructions in Info.plist to run JavaApplicationStub using x86_64 if possible, and to run the JVM using x86_64 as well - in both cases, with fallbacks to i386 and then PPC.

Build one simply removed the instruction to run the stub using x86_64, and was trying to run it in i368.

Build two did that, and replaced the stub with another version of the stub that didn't have x86_64 baked into it, and that 0.52.1a shipped with (which made it seem a safe choice), but still asked to launch the JVM in 64 bit.

Build three did both of the above, but didn't ask to launch the JVM in 64 bit.


I know for a fact the stubs are somewhat buggy... but the fact that Gatekeeper is treating these differently just seems wrong. None of the app bundles are signed. If they don't work in one way or another, alright, fine - but the stuff Gatekeeper does seems like it should be happening before whether or not the bundle will actually run successfully is even known. Apparently, it just really doesn't like JavaApplicationStub from build one - since build two and three do not get into "state 4".


If I could impose on you yet again... would you mind giving this (https://s3.amazonaws.com/fractalsoftworks/starfarer/release/starfarer_mac-0.53.1a-test-arch.zip) build a try? It's using yet another version of JavaApplicationStub - this one from a Java install on a 10.8 system. It does not try to run the stub in 64 bit, but does try to run the JVM in 64 bit if possible.
Title: Re: Mac Download
Post by: brian on August 13, 2012, 12:05:21 AM
It behaves the same as build 1, throwing the <appname> is damaged and can't be opened error.

Additionally, I noticed that each run puts this in the Console:

8/13/12 2:57:10.807 PM CoreServicesUIAgent[1319]: Error SecAssessmentCreate: The operation couldn’t be completed. (OSStatus error -67061.)
8/13/12 2:57:13.229 PM com.apple.launchd.peruser.501[268]: ([0x0-0x112112].com.Fractal Softworks LLC.Starfarer.Starfarer[1353]) Exited: Killed: 9

I am running OS X 10.8, build 12A269

java version 1.6.0_33
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)

Let me know if there's anything else you need. I'll look into this in greater detail after office hours..


---edit---

Just to be more specific:

starfarer_mac-0.53a-RC4 - fails.
starfarer_mac-0.53a-test-arch - works.
starfarer_mac-0.53a-test-stub  - works.
starfarer_mac-0.53a-test-info - fails.
starfarer_mac-0.53.1a-test-arch - fails.

By fail I mean, case (4), and by works I mean case (2).
Title: Re: Mac Download
Post by: Alex on August 13, 2012, 10:15:51 AM
Thanks for giving it a try. Using the info you provided, finally tracked down what it is:

http://lists.apple.com/archives/java-dev/2012/Jul/msg00150.html

Apparently, the JavaApplicationStub that comes with later versions of OS X is signed by Apple, which (somehow?) causes this behavior. I guess it sees the whole app as incorrectly signed, or some such. Older versions of the stub are not signed, so they work. Yay, progress - I'm just waiting for when you can't run anything that didn't come from the Mac App Store, period... Also, the whole concept of a JavaApplicationStub is insane in the first place. How about, you know, letting an app run a shell script as the entry point? /rantoff


There's also some ruby linked in that post that removes the signature from the stub... stay tuned. (I need to use the new stub to run the JVM in 64 bit, because the old stub has a bug where it can't do that.)
Title: Re: Mac Download
Post by: Alex on August 13, 2012, 10:35:42 AM
Alright! Could you try this (https://s3.amazonaws.com/fractalsoftworks/starfarer/release/starfarer_mac-0.53.1a-unsigned.zip) one? Same stub as before, sans Apple's signature - if this actually works, then stuff is in good shape.

Thank you again for all your help.
Title: Re: Mac Download
Post by: NateS on February 15, 2013, 07:49:47 AM
Hi Alex, I'm NateS from JGO. Sorry to necro this thread, but this thread rocks. :) I have a 2D skeletal animation tool, Spine (http://www.kickstarter.com/projects/esotericsoftware/spine), and users are having trouble on OSX. The launcher you provided in your last post has been working great for months. As far as I could find you are the only one on the entire innertubes to have figured out how to make a launcher that doesn't prompt to move the app to the trash! However, it seems that if a user only has Java 7 checked in their Java Preferences, then the launcher doesn't work. Instead, it shows a dialog that says no Java 6+ version could be found. This happens to Spine, I also downloaded and checked Starsector mac-0.54.1a-RC2 and the same thing happens there.

Maybe we can work together to figure this out. I guess we need an updated stub, then to remove the signature...

Apple sucks! :(

Edit: Looks like it's expected behavior for the launcher to not find Java 7, see response here:
http://lists.apple.com/archives/java-dev/2012/Apr/msg00114.html

I packaged my app with a JRE and it worked on OSX, though I went from 6mb to 38mb. Fuuuuuu

Edit2: It occurs to me that bundling the JRE is running a shell script... so there is no reason why I can't just launch Java from the shell script and call it a freaking day. Right? Right?! So that seems to work just fine. I made you a skeleton .app example that uses this in case you want to do the same:
http://n4te.com/temp/AppleSucksSoMuch.app.zip
Just put in your JAR, editor the plist, run.sh, icons, splash, etc.
Title: Re: Mac Download
Post by: Alex on February 15, 2013, 11:44:55 AM
Hi! Are you "Nate" on JGO? If so, I remember seeing you around quite a bit.

Can't take too much credit for the application stub thing - the hard work was done by whoever wrote that evil, evil ruby script :) Glad you found it useful, though.

Thank you for all the info and the example app bundle, this is really helpful. I've kind of been dreading digging back into that mess, and this should make it so much easier.

So... looks like you can actually use scripts as an entry point for an app bundle now? I wonder if this is a new development or if I was just being dense and didn't figure out how. I guess given that things like this (http://sveinbjorn.org/platypus) exist, it's hopefully the former.

But wait, this probably means that the .app you made won't work on earlier versions of OS X. Let me give it a try here, I've still got 10.6 on my Macbook. Hmm, it actually seems to work - shows a Spine splash screen and exits out. Well, this is great, if slightly confusing.

I'm probably going to bundle the JRE with the game, just to not have to worry about this sort of thing down the line when Apple decides to stop including Java by default altogether. But then, for me it's only increasing the download size by a factor of 2 or so, not 6.

Need to wait until LWJGL is working properly with Java 7, though... (hey, I see you in this (http://lwjgl.org/forum/index.php/topic,4711.165.html) thread.)

Congratulations on the successful Kickstarter for Spine, btw! It looks very slick.
Title: Re: Mac Download
Post by: NateS on February 15, 2013, 12:37:15 PM
Yessir, that is me on the JGO and LWJGL forums. :) And thanks for the kind words about Spine. Just managing all the questions has been a full time job!

I'm using the experimental LWJGL stuff only for Mac, as of earlier today. We'll see how it goes when my testers users have some time to try it out. ;) Not sure why I was seeing some weird stuff with ctrl and clicking on Windows, I wouldn't expect Windows to change...

Thanks for testing on 10.6, I was a little worried about that. I'm not sure if there is any good reason to ever use the JavaApplicationStub, which is also a little scary. :)

I ended up changing my script a little, as I needed the working directory to be the one containing the .app file. Looks like this now:
Code
#!/bin/bash

cd "`dirname \"$0\"`/../../.."
"java" \
    -Xdock:name="Spine" \
    -Xdock:icon=../Resources/icon.icns \
    -Dapple.laf.useScreenMenuBar=true \
    -Dcom.apple.macos.useScreenMenuBar=true \
    -Dapple.awt.showGrowBox=false \
    -Dfile.encoding=UTF-8 \
    ${EXTRAARGS} \
    -Xmx512m \
    -splash:Spine.app/Contents/MacOS/splash.png \
    -cp Spine.app/Contents/MacOS/spine.jar \
    com.esotericsoftware.spine.editor.Editor \
    "$@" \
    2>&1

exit 0

To bundle your game, you might look at princec's Droid Assault (http://downloads.puppygames.net/DroidAssault_MacOSX.zip) which bundles OpenJDK 7 and is what the stuff I've posted is based on.