devroom.io/content/posts/2009-09-01-jinput-mac-os-x-64-bit-natives.md

39 lines
2.5 KiB
Markdown
Raw Normal View History

2015-03-26 11:28:08 +00:00
+++
date = "2009-09-01"
title = "JInput Mac OS X 64 bit natives"
tags = ["Java", "64bit", "lwjgl", "jinput", "slick2d", "jme"]
slug = "jinput-mac-os-x-64-bit-natives"
+++
Yesterday I ran into a little problem running <a href="http://slick.cokeandcode.com/index.php">Slick 2D</a> on Java 6 64bit on my Mac. It's a MacPro, which has a 64 bit processor and is running Leopard. The problem I encountered was related to the native libraries provided by <a href="http://www.lwjgl.org">LWJGL</a>.
If you're a user of LWJGL, you'll be using JInput as well. Unfortunately, JInput does not currently have any 64 bit native libraries as it is only providing for PPC and i386 (32bit). This is a problem because Mac OS X users are somewhat bound to Java 6 64bit. There is no 32 bit version of Java 6 for Mac OS X.
<!--more-->
<pre lang="none">
$ file libjinput-osx.jnilib
libjinput-osx.jnilib: Mach-O universal binary with 2 architectures
libjinput-osx.jnilib (for architecture ppc): Mach-O dynamically linked shared library ppc
libjinput-osx.jnilib (for architecture i386): Mach-O dynamically linked shared library i386
</pre>
Thus, the default JInput natives provided by LWJGL, and subsequently by projects like <a href="http://slick.cokeandcode.com/index.php">Slick 2D</a> and <a href="http://www.jmonkeyengine.com/">jME</a> are of no use on a system running Java 6 64 bit. Also games and other apps based on those libraries won't run on Java 6 64 bit!
To solve this, I recompiled the JInput natives from CVS with 64 bit support:
<pre lang="none">
$ file libjinput-osx.jnilib
libjinput-osx.jnilib: Mach-O universal binary with 3 architectures
libjinput-osx.jnilib (for architecture ppc): Mach-O dynamically linked shared library ppc
libjinput-osx.jnilib (for architecture i386): Mach-O dynamically linked shared library i386
libjinput-osx.jnilib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
</pre>
I packaged the Mac OS X native (<code>libjinput-osx.jnilib</code>) and the resulting <code>jinput.jar</code> and <code>jinput-test.jar</code> up and you can download them here:
<a href="http://ariejan.net/wp-content/uploads/2009/09/jinput-20090901-osx+ppc+i386+x86_64.tar1.gz">jinput-20090901-osx+ppc+i386+x86_64.tar</a>
<em>Note: I'm not running Linux or Windows at the moment, so I can't provide any recompiled binaries for those platforms.</em>
<em>Question: now, how do I package this up nicely so I can use it in my <a href="http://slick.cokeandcode.com/index.php">Slice 2D</a> based app?</em>