Bug 189028

Summary: games/minecraft-client requires custom script from Mojang launcher
Product: Ports & Packages Reporter: Sean Bruno <sbruno>
Component: Individual Port(s)Assignee: John Marino <marino>
Status: Closed FIXED    
Severity: Affects Only Me CC: adrian, kmoore, marino
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197063
Attachments:
Description Flags
file.diff
none
Patch against svn ports head, based and copied on previous attachment
none
Minecraft Console Log none

Description Sean Bruno freebsd_committer 2014-04-26 17:40:00 UTC
minecraft client will startup fine with openjdk7, but the mojang launcher cannot use openjdk7 to spawn the game.

Output from the game console:

[09:30:57 INFO]: Half command: /usr/local/openjdk7/jre/bin/java -Xmx1G -Djava.library.path=/home/sbruno/.minecraft/versions/1.7.9-freebsd/1.7.9-freebsd-natives-11440901825974 -cp /home/sbruno/.minecraft/libraries/java3d/vecmath/1.3.1/vecmath-1.3.1.jar:/home/sbruno/.minecraft/libraries/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar:/home/sbruno/.minecraft/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar:/home/sbruno/.minecraft/libraries/net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar:/home/sbruno/.minecraft/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:/home/sbruno/.minecraft/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar:/home/sbruno/.minecraft/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar:/home/sbruno/.minecraft/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar:/home/sbruno/.minecraft/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120
 107.jar:/home/sbruno/.minecraft/libraries/io/netty/netty-all/4.0.10.Final/netty-all-4.0.10.Final.jar:/home/sbruno/.minecraft/libraries/com/google/guava/guava/15.0/guava-15.0.jar:/home/sbruno/.minecraft/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar:/home/sbruno/.minecraft/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar:/home/sbruno/.minecraft/libraries/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/home/sbruno/.minecraft/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar:/home/sbruno/.minecraft/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar:/home/sbruno/.minecraft/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar:/home/sbruno/.minecraft/libraries/com/mojang/authlib/1.5.13/authlib-1.5.13.jar:/home/sbruno/.minecraft/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar:/home/sbruno/.minecraft/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar:/home/sbruno/.minecraft/librari
 es/org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.j!
 ar:/home/sbruno/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar:/home/sbruno/.minecraft/libraries/tv/twitch/twitch/5.16/twitch-5.16.jar:/home/sbruno/.minecraft/versions/1.7.9-freebsd/1.7.9-freebsd.jar net.minecraft.client.main.Main
[09:30:57 ERROR]: Couldn't launch game
java.io.IOException: Cannot run program "/usr/local/openjdk7/jre/bin/java" (in directory "/home/sbruno/.minecraft"): error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) ~[?:1.7.0_55]
	at net.minecraft.launcher.process.JavaProcessLauncher.start(JavaProcessLauncher.java:28) ~[launcher.jar:?]
	at net.minecraft.launcher.GameLauncher.launchGame(GameLauncher.java:312) [launcher.jar:?]
	at net.minecraft.launcher.GameLauncher.onDownloadJobFinished(GameLauncher.java:627) [launcher.jar:?]
	at net.minecraft.launcher.updater.download.DownloadJob.popAndDownload(DownloadJob.java:120) [launcher.jar:?]
	at net.minecraft.launcher.updater.download.DownloadJob.access$000(DownloadJob.java:12) [launcher.jar:?]
	at net.minecraft.launcher.updater.download.DownloadJob$1.run(DownloadJob.java:89) [launcher.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_55]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_55]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_55]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_55]
	at java.lang.Thread.run(Thread.java:745) [?:1.7.0_55]
Caused by: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.forkAndExec(Native Method) ~[?:1.7.0_55]
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:184) ~[?:1.7.0_55]
	at java.lang.ProcessImpl.start(ProcessImpl.java:130) ~[?:1.7.0_55]
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022) ~[?:1.7.0_55]
	... 11 more
[09:30:57 INFO]: Deleting /home/sbruno/.minecraft/versions/1.7.9-freebsd/1.7.9-freebsd-natives-11440901825974

Fix: Switch minecraft-client to use openjdk8
How-To-Repeat: install and run games/minecraft-client
Comment 1 Edwin Groothuis freebsd_committer 2014-04-26 20:27:41 UTC
Maintainer of games/minecraft-client,

Please note that PR ports/189028 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/189028

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer 2014-04-26 20:27:42 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 emz 2014-05-14 09:01:00 UTC
I confirm this, on FreeBSD 10.0-RC5.
Comment 4 emz 2014-05-14 09:52:03 UTC
However, this fix doesn't work for me as is. In order to play recent
minecraft, one has to run the wrapper script via profile customization
(replacing the java executable) which mentioned in
http://forums.freebsd.org/viewtopic.php?t=42932 (notice that library
version have changed since the original post, so you have to edit the
wrapper script).
Comment 5 Sean Bruno freebsd_committer 2014-06-04 16:09:36 UTC
Confirmed.  Run the minecraft java launcher normally:

"${JAVA VERSION OF CHOICE} -jar /usr/local/share/minecraft-client/Minecraft.jar"

Then in settings of the launcher, change the execution to use the script referenced in the forum post.
Comment 6 John Marino freebsd_committer 2014-06-10 13:33:00 UTC
Is it known why openjdk7 doesn't work?

I'm not really comfortable just "switching" to openjdk8 without understand why that works.  Isn't it rather a sign that openjdk7 needs fixing perhaps?
Comment 7 Sean Bruno freebsd_committer 2014-06-10 13:35:05 UTC
(In reply to John Marino from comment #6)
> Is it known why openjdk7 doesn't work?
> 
> I'm not really comfortable just "switching" to openjdk8 without understand
> why that works.  Isn't it rather a sign that openjdk7 needs fixing perhaps?

I think the title is wrong.

The actual problem seems to be lost in my comments on this, i.e. that the script invoking the minecraft client needs to be modified.  This has nothing to do with openjdk7 as far as I can tell.
Comment 8 John Marino freebsd_committer 2014-06-10 13:38:55 UTC
well, switching to openjdk8 is what the diff says as well as your very first comment:

Fix: Switch minecraft-client to use openjdk8
How-To-Repeat: install and run games/minecraft-client

so .... ??
Comment 9 Sean Bruno freebsd_committer 2014-06-10 14:05:02 UTC
Comment on attachment 142065 [details]
file.diff

This is not the correct solution, ignore this.
Comment 10 Kris Moore freebsd_committer 2014-06-18 21:40:09 UTC
I've just updated this port with a fix in our PC-BSD git repo:

https://github.com/pcbsd/freebsd-ports/commit/7f9c301223f345d2e29f2dc1e64f507c157bdaea

and

https://github.com/pcbsd/freebsd-ports/commit/cefde09dd8f9964243c09b5ce4776ea17af7e32b

It does the following:

* Adds depend upon games/lwjgl, openjdk8 and bash
* Adds minecraft-runtime to adjust java flags for correct lwjgl libs
* Fixes the users minecraft profile at launch to use minecraft-runtime script
* Adds small java "popup" to warn users that they need to close / re-open the launcher after logging in to get the fixed runtime

If this seems a good fix, I'll be happy to commit to FreeBSD tree, otherwise any of you guys can do it as well.
Comment 11 Sean Bruno freebsd_committer 2014-06-19 00:10:02 UTC
(In reply to Kris Moore from comment #10)
> I've just updated this port with a fix in our PC-BSD git repo:
> 
> https://github.com/pcbsd/freebsd-ports/commit/
> 7f9c301223f345d2e29f2dc1e64f507c157bdaea
> 
> and
> 
> https://github.com/pcbsd/freebsd-ports/commit/
> cefde09dd8f9964243c09b5ce4776ea17af7e32b
> 
> It does the following:
> 
> * Adds depend upon games/lwjgl, openjdk8 and bash
> * Adds minecraft-runtime to adjust java flags for correct lwjgl libs
> * Fixes the users minecraft profile at launch to use minecraft-runtime script
> * Adds small java "popup" to warn users that they need to close / re-open
> the launcher after logging in to get the fixed runtime
> 
> If this seems a good fix, I'll be happy to commit to FreeBSD tree, otherwise
> any of you guys can do it as well.

Confirmed.  This is definitely a better solution that any others proposed.

Tested here on -current boxes in the upgrade and new install scenarios.  Both work.
Comment 12 John Marino freebsd_committer 2014-06-19 21:00:33 UTC
Sean, it sure would be great if you could attach a ready-to-commit diff to this PR to make my life a lot easier. :)
Comment 13 Sean Bruno freebsd_committer 2014-06-19 23:10:38 UTC
Created attachment 143945 [details]
Patch against svn ports head, based and copied on previous attachment

One is pleased to be of service.  Patch attached.  Redbuilds complete for 9/10/11

Local poudriere run and test seems happiness for new install and upgrade.
Comment 14 John Marino freebsd_committer 2014-06-20 10:14:11 UTC
okay, great.  In the future, you should past the link of the redport builds in case I want to check the logs myself.
Comment 15 John Marino freebsd_committer 2014-06-20 10:33:35 UTC
In a moment of cleverness, I figured it out:
https://redports.org/buildarchive/20140619212201-9371/

(now I'm wondering why FreeBSD 8 was skipped)
Comment 16 John Marino freebsd_committer 2014-06-20 10:37:26 UTC
I'm going to set PORTREVISION 0 => 1 instead of 0 => 2 as the patch defines.
Comment 17 John Marino freebsd_committer 2014-06-20 10:40:02 UTC
By the way, I'd still really appreciate an explanation why OpenJDK8 is the minimum OpenJDK for minecraft now.  Is that known?

I'm asking because it could indicate a problem with OpenJDK7 build -- I'm guessing minecraft-client is supposed to work on OpenJDK7 and this is papering over an issue...
Comment 18 commit-hook freebsd_committer 2014-06-20 10:45:46 UTC
A commit references this bug:

Author: marino
Date: Fri Jun 20 10:45:13 UTC 2014
New revision: 358549
URL: http://svnweb.freebsd.org/changeset/ports/358549

Log:
  games/minecraft-client: Use OpenJDK8 to fix spawning problem

  PR:		189028
  Submitted by:	Sean Bruno
  Fix by:		Kris Moore

Changes:
  head/games/minecraft-client/Makefile
  head/games/minecraft-client/files/Notifer.java
  head/games/minecraft-client/files/minecraft-client
  head/games/minecraft-client/files/minecraft-runtime
  head/games/minecraft-client/pkg-plist
Comment 19 Sean Bruno freebsd_committer 2014-06-20 15:05:02 UTC
(In reply to John Marino from comment #15)
> In a moment of cleverness, I figured it out:
> https://redports.org/buildarchive/20140619212201-9371/
> 
> (now I'm wondering why FreeBSD 8 was skipped)

I don't normally test on 8, but I should have for this.  Do we care?
Comment 20 Kris Moore freebsd_committer 2014-06-20 15:06:37 UTC
(In reply to John Marino from comment #17)
> By the way, I'd still really appreciate an explanation why OpenJDK8 is the
> minimum OpenJDK for minecraft now.  Is that known?
> 
> I'm asking because it could indicate a problem with OpenJDK7 build -- I'm
> guessing minecraft-client is supposed to work on OpenJDK7 and this is
> papering over an issue...

John,

I did the initial testing with OpenJDK7, and it ran into various errors whenever it tried to start the actual application. I don't recall the specific java error messages at the moment, but switching to OpenJDK8 "just works".
Comment 21 Sean Bruno freebsd_committer 2014-06-20 15:08:32 UTC
(In reply to Kris Moore from comment #20)
> (In reply to John Marino from comment #17)
> > By the way, I'd still really appreciate an explanation why OpenJDK8 is the
> > minimum OpenJDK for minecraft now.  Is that known?
> > 
> > I'm asking because it could indicate a problem with OpenJDK7 build -- I'm
> > guessing minecraft-client is supposed to work on OpenJDK7 and this is
> > papering over an issue...
> 
> John,
> 
> I did the initial testing with OpenJDK7, and it ran into various errors
> whenever it tried to start the actual application. I don't recall the
> specific java error messages at the moment, but switching to OpenJDK8 "just
> works".

I'll run some test on -current and "see what happens."
Comment 22 Sean Bruno freebsd_committer 2014-06-21 14:50:56 UTC
Created attachment 143996 [details]
Minecraft Console Log

Confirmed that openjdk7 cannot run minecraft.  openjdk8 works just fine.