Skip to content

Compiling on MacOS (ARM)

djoslin0 edited this page Feb 16, 2022 · 3 revisions

Set up the environment

Start a terminal through Rosetta by running arch -x86_64 zsh. All commands in this tutorial must be run within this terminal.

Follow the Homebrew installation instructions here, pasting the given line in Rosetta Terminal.

TIP: To make your life easier, add the following aliases to your .zshrc

alias ibrew="arch -x86_64 /usr/local/bin/brew"
alias iarch="arch -x86_64"

Install dependencies.

After installing homebrew, enter this command in the Rosetta terminal to install packages necessary to build sm64ex:

/usr/local/bin/brew install make mingw-w64 gcc gcc@9 sdl2 pkg-config glew glfw3 libusb audiofile coreutils

Disable ARM dependencies

You will need to disable glew and SDL2 if you have installed them using native brew. You can do this either by uninstalling them through native brew, or by temporarily renaming the symlinks in /opt/homebrew/Cellar/[dependency]. The build system will choke on ARM dependenices without even looking for compatible x86_64 dependencies.

Obtain the source code.

git clone https://github.com/djoslin0/sm64ex-coop.git
cd sm64ex-coop

Copy baserom(s) for asset extraction.

For each version (jp/us/eu) that you want to build an executable for, put an existing ROM at ./baserom.<version>.z64 for asset extraction.

For example, if you want to build the US version, there should be a ROM file called baserom.us.z64 in the sm64ex directory (meaning next to the Makefile).

NOTE: Only the us version is currently supported on coop.

If during the build process you get messages saying that the ROM has an incorrect hash, there is a possibility that it's a V64 ROM that needs to be byteswapped. To do that, use this web tool.

Compile the game

To turn certain features on and off, append any needed build flags to your gmake invocation:

gmake OSX_BUILD=1 TARGET_ARCH=x86_64-apple-darwin TARGET_BITS=64

OSX_BUILD must be specified to be 1. TARGET_ARCH must be x86_64-apple-darwin TARGET_BITS must be 64

NOTE: You will be unable to build a native M1 build until this project is moved off of GCC 9. Running through Rosetta will work fine.

Run the game

./build/us_pc/sm64.us.f3dex2e