OpenJK icon indicating copy to clipboard operation
OpenJK copied to clipboard

Add native support for Apple M1 chips

Open xycaleth opened this issue 3 years ago • 12 comments

My guess is there are some assumptions in the code that Apple means x86/x86_64. Would be good to remove all of these assumptions so that OpenJK can compile/run on Apple's new M1 devices which are ARM based.

xycaleth avatar Nov 20 '20 08:11 xycaleth

These games are from the era in which Apple was synonymous with PowerPC hardware (Quake III Arena: 1999, Jedi Outcast: 2002, Jedi Academy: 2003, Apple transition to x86: 2006) so it would surprise me if there are "Apple = x86" assumptions.

As far as I know, the Apple M1 is a reasonably normal aarch64 (ARMv8A) CPU. OpenJK is regularly compiled for aarch64 Linux on Debian's infrastructure; I don't know of anyone actually testing the result (I don't have an aarch64 myself).

smcv avatar Jan 25 '21 11:01 smcv

Perhaps there weren't any assumptions at the time, but there's certainly a few since we ported the code to Mac (e.g. the binary extensions are assumed to be x86_64 for Mac). I had a quick try a few weeks ago and had to make a few changes. I didn't get very far cause I can't download the dependencies for the arm architecture.

xycaleth avatar Jan 25 '21 18:01 xycaleth

I'm not sure if it might be of any help but this guy got Jedi Academy running on an M1 Macbook Air via Rosetta 2 and SDL2, he used EternalJK, but I'm assuming it could be done with OpenJK as well. Now, I know you probably meant native support but this might be a good solution in the mean time.

ghost avatar Mar 01 '21 15:03 ghost

SDL2 has native binary for aarch64 m1 chip via homebrew so just should not be an issue still. But plenty of places assume intel/x86* on mac.

ensiform avatar Mar 01 '21 18:03 ensiform

SDL2 has native binary for aarch64 m1 chip via homebrew so just should not be an issue still.

When I said "native" I meant without needing Rosetta or SDL2.

ghost avatar Mar 01 '21 18:03 ghost

SDL2 is always going to be used in this project. It's integrated on all platforms.

ensiform avatar Mar 01 '21 18:03 ensiform

SDL2 is always going to be used in this project. It's integrated on all platforms.

Well, just without Rosetta then.

ghost avatar Mar 01 '21 18:03 ghost

This is the tutorial he mentioned in the video, according to him, the only extra step needed is to install Rosetta 2.

ghost avatar Mar 01 '21 19:03 ghost

I'm not sure if it might be of any help but this guy got Jedi Academy running on an M1 Macbook Air via Rosetta 2 and SDL2, he used EternalJK, but I'm assuming it could be done with OpenJK as well. Now, I know you probably meant native support but this might be a good solution in the mean time.

I don't see any reason why OpenJK wouldn't run on Rosetta on an M1 Mac so I think we're in agreement there. This issue is just about having OpenJK run natively

xycaleth avatar Mar 01 '21 20:03 xycaleth

I don't see any reason why OpenJK wouldn't run on Rosetta on an M1 Mac so I think we're in agreement there. This issue is just about having OpenJK run natively

Ah, to be honest, I don't really care about it running natively, I just wanted a feasible way to run it on an M1 Mac, you should probably add a tutorial on the README for installing and running OpenJK on an M1 Mac, in case anyone else wants to play Jedi Academy on theirs, at least until you find a way to run it natively.

ghost avatar Mar 01 '21 20:03 ghost

It is possible to run the latest compiled OpenJK OSX version from https://builds.openjk.org/ in a Macbook Air M1. All you need to do is find a libsdl2-2.0.0.dylib from another project and place it in /usr/local/lib. I used the libsdl2-2.0.0.dylib from https://github.com/shinyquagsire23/OpenJKDF2

eduardodesigner avatar Dec 27 '21 01:12 eduardodesigner

https://github.com/JACoders/OpenJK/pull/1115

jaiko avatar Jan 28 '22 21:01 jaiko

Users can download signed and notarised Universal 2 builds of OpenJK and OpenJO from Mac Source Ports, so this issue can probably be closed.

shinra-electric avatar Oct 10 '22 18:10 shinra-electric

I wonder how MacSilicon builds managed to take this compilation hurdle (MP only):

timing h_OpenJK

#1131

ArminiusTux avatar Dec 27 '23 19:12 ArminiusTux

I wonder how MacSilicon builds managed to take this compilation hurdle (MP only):

you can check you changes made on their github fork

shinra-electric avatar Dec 27 '23 21:12 shinra-electric