⚒️
Apple Silicon(arm64)で HashLink をビルドする
Haxe言語用のVMである HashLink は arm64 に非対応です。
HashLinkの JIT 実装が x86 向けに最適化されており、arm64 対応のコードを追加するのが困難なためのようです[1]。
なので x86_64向けにコンパイルし Rosetta 経由で使用するようにします。
手順
基本的に以下の記事の通り実施するだけです。
Compiling HashLink on macOS Apple Silicon - Haxe - Haxe Community
- x86_64向け Homebrew のインストール
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- git clone
git clone https://github.com/HaxeFoundation/hashlink.git
cd hashlink
- 依存関係のインストール
arch -x86_64 /usr/local/bin/brew bundle
CMake
のインストールで失敗することがありますが問題ないので無視して結構です。
Installing cmake has failed!
Installing jpeg-turbo
...
Installing sqlite
`brew bundle` failed! 1 Brewfile dependency failed to install
- OpenAL のシンボリックリンク作成
ln -s /usr/local/opt/openal-soft/include/AL /usr/local/include/AL
ln -s /usr/local/opt/openal-soft/lib/libopenal.dylib /usr/local/lib/libopenal.dylib
- make
arch -x86_64 make \
BREW_PREFIX=/usr/local \
INCLUDE_DIR=/usr/local/include \
LIB_DIR="-L/usr/local/lib"
以上
作業ディレクトリに hl
ファイルが作成されていれば成功です。
$ uname -m
arm64
$ file ./hl
./hl: Mach-O 64-bit executable x86_64
$ ./hl
HL/JIT 1.16.0 (c)2015-2025 Haxe Foundation
Usage : hl [--debug <port>] [--debug-wait] <file>
Discussion