OpenArena/engine

When compiling the game on macOS, app bundle generation fails

cubuspl42 opened this issue · 1 comments

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: #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.

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 #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.