OpenArena / engine

OpenArena modifications to the ioquake3 engine
http://openarena.ws
GNU General Public License v2.0
211 stars 50 forks source link

When compiling the game on macOS, app bundle generation fails #69

Open cubuspl42 opened 2 years ago

cubuspl42 commented 2 years ago

Setup: macOS Big Sur 11.6.1 (20G224) Apple clang version 13.0.0 (clang-1300.0.29.30)

When compiling the game through the make-macosx.sh script, generating app bundle (through make-macosx-app.sh) fails. The openarena.x86_64 binary compiles successfully and can be launched from the Terminal (although you can't really play: https://github.com/OpenArena/engine/issues/61).

The error message:

./make-macosx-app.sh: no ioquake3 binary architectures were found for target 'release'

After a quick investigation of the make-macosx-app.sh it seemed to me that the PRODUCT_NAME="ioquake3" should be changed to PRODUCT_NAME="openarena" (I don't know how this script ever worked before as-is), so I changed that.

But then, I got many errors similar to...

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: no input files specified
usage: lipo <input_file> <command> [<options> ...]

As I'm not familiar with these Xcode command line tools and I'm not sure how/if that worked before, I don't know what's the solution here.

cubuspl42 commented 2 months ago

Workaround:

  1. Start with the official app bundle (I got one from the official website)

  2. Build the engine for x86-64

For Apple Silicon Macs, see https://github.com/OpenArena/engine/issues/89

  1. Replace the executable binary
cp ./build/release-darwin-x86_64/openarena.x86_64 /path/to/OpenArena.app/Contents/MacOS/openarena.ub
  1. Bundle the Homebrew-provided libraries
cp /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib /path/to/OpenArena.app/Contents/MacOS/
cp /usr/local/opt/libvorbis/lib/libvorbisfile.3.dylib /path/to/OpenArena.app/Contents/MacOS/
cp /usr/local/opt/libvorbis/lib/libvorbis.0.dylib /path/to/OpenArena.app/Contents/MacOS/
cp /usr/local/opt/libxmp/lib/libxmp.4.dylib /path/to/OpenArena.app/Contents/MacOS/
  1. Fix the dynamic library links
install_name_tool -change /usr/local/opt/libvorbis/lib/libvorbis.0.dylib @executable_path/libvorbis.0.dylib /path/to/OpenArena.app/Contents/MacOS/libvorbisfile.3.dylib

install_name_tool -change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib @executable_path/libSDL2-2.0.0.dylib /path/to/OpenArena.app/Contents/MacOS/openarena.ub
install_name_tool -change /usr/local/opt/libvorbis/lib/libvorbisfile.3.dylib @executable_path/libvorbisfile.3.dylib /path/to/OpenArena.app/Contents/MacOS/openarena.ub
install_name_tool -change /usr/local/opt/libvorbis/lib/libvorbis.0.dylib @executable_path/libvorbis.0.dylib /path/to/OpenArena.app/Contents/MacOS/openarena.ub
install_name_tool -change /usr/local/opt/libxmp/lib/libxmp.4.dylib @executable_path/libxmp.4.dylib /path/to/OpenArena.app/Contents/MacOS/openarena.ub

There might be a better way.

I released the app bundle built with this method here.