Skip to main content

JInput Mac OS X 64 bit natives

·297 words·2 mins· ·
Java 64bit Lwjgl Jinput Slick2d Jme
Ariejan de Vroom
Author
Ariejan de Vroom
Jack of all Trades, Professional Software Craftsman

Yesterday I ran into a little problem running Slick 2D 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 LWJGL.

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.


$ 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

Thus, the default JInput natives provided by LWJGL, and subsequently by projects like Slick 2D and jME 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:


$ 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

I packaged the Mac OS X native (libjinput-osx.jnilib) and the resulting jinput.jar and jinput-test.jar up and you can download them here:

jinput-20090901-osx+ppc+i386+x86_64.tar

Note: I’m not running Linux or Windows at the moment, so I can’t provide any recompiled binaries for those platforms.

Question: now, how do I package this up nicely so I can use it in my Slice 2D based app?