libgdx/gdx-liftoff

Jpackage error on macOs

4lfg24 opened this issue · 13 comments

I was trying to run the "jpackageImage" gradle task, but i get an error saying "Invalid Option: [ --java-options]", could you please tell me what's wrong? Thank you in advance.

So, fair warning: I don't have a Mac to test on, so if something works at all on a Mac it is either because it works everywhere or because someone reported that something went wrong. So, thanks for the report! Can you try changing this line, in lwjgl3/build.gradle, inside jpackage, in the if (os.contains('mac')) block:

                imageOptions = ["--icon", "icons/logo.icns", " --java-options", "\"XstartOnFirstThread\""]

There seems to be an extra space char in " --java-options", at the start; can you try removing that first? This snuck into the 1.11.0.3 release.

I tried doing that but it gives me this error instead: "Bundler Mac Application Image skipped because of a configuration problem: The first number in an app-version cannot be zero or negative.
Advice to fix: Set a compatible 'app-version' value. Valid versions are one to three integers separated by dots."

You probably need to change some version, somewhere. The default is 0.0.1, so that probably needs to be 1.0.1 or something. It's an incredibly dumb rule on Apple's part...

In the root build.gradle, the version is near the bottom, in subprojects.

subprojects {
	version = '0.0.1' // try changing this to 1.0.0
...
}

Thank you it seems to work, now i have a jpackage directory that looks like this:
Schermata 2022-08-29 alle 09 33 19
In the MacOs directory there is a "testinggdx-liftoff" bash script, but when I start it nothing happens, what's the next step?

Looks close to correct right now, the .app folder should appear as an application in Finder. It might already work, I don't know. The bash script should be launched as part of the .app getting launched from Finder, and the path structure is really only meant to be launched from the Finder. It might be possible to launch from the command line or from inside IDEA, but... yeah try the Finder, I don't know of a better way.

It might be possible to launch from the command line

open testinggdx-liftoff.app should work

I have the same issue. Just preparing to the next ludum dare and I wanted to start with a clear setup. On my M1 macbook the above adviced things are 100% required, I can confirm:

  • remove the extra space before --java-options
  • change the subprojects.version to at least 1.0.0 in build.gradle in the root.

After these, running ./gradlew jpackage does build my .app file.

The issue is that if I click on that, nothing happens. Not even a line of log :D Just simply running with ./gradlew run it works though.

I use Zulu JDK 17, and latest gdx-liftoff.

OK, found it. You just left a dash before the vm option. The correct line would be then:

imageOptions = ["--icon", "icons/logo.icns", "--java-options", "\"-XstartOnFirstThread\""]

Sorry to re-open this issue but I'm experiencing another problem, when I open the app (both from the terminal and normally) I get an error, from the terminal it says "LSOpenURLsWithRole() failed with error -10810", does anyone know how to fix this?

Maybe either executable permission is missing chmod +x /path/to/executable (NOTE: Not the .app folder, but the executable inside it)? Or quarantined sudo xattr -r -d com.apple.quarantine /path/to/App.app?
@4lfg24

Sorry to re-open this issue but I'm experiencing another problem, when I open the app (both from the terminal and normally) I get an error, from the terminal it says "LSOpenURLsWithRole() failed with error -10810", does anyone know how to fix this?

From my side, it works for me. May I ask you to send the .app here please? And then I can try it on my macbook.

@4lfg24 Maybe the latest fix isn't working because I haven't built a new stable release? And the older release still has the issues? I can build the latest and post it here if it would help.

I'm sorry the zip file is superior to 25 MB, where can i post it?