Build angelscript arm64 calling-convention asm on macOS#140
Merged
Conversation
On Apple Silicon (arm64) angelscript enables its native calling
convention (AS_ARM64), so CallSystemFunctionNative references CallARM64,
GetHFAReturn*, etc. Those symbols are defined in a hand-written assembly
stub, but the Skirmish AI source glob only collects C/C++ sources, so no
.S file is ever compiled and linking SkirmishAI fails with:
Undefined symbols for architecture arm64:
"_CallARM64", "_CallARM64Double", "_CallARM64Float",
"_CallARM64Ret128", "_CallARM64RetInMemory",
"_GetHFAReturnDouble", "_GetHFAReturnFloat"
Add the asm stub explicitly on Apple+arm64 and enable the ASM language.
The xcode variant is required (not the gcc one) because Mach-O prefixes
symbols with a leading underscore, independent of the compiler used.
Assisted by Claude Code; verified by building on macOS (Homebrew GCC 16,
Apple Silicon): SkirmishAI.dylib and spring-headless link cleanly.
37184e9 to
8331880
Compare
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building the BARb Skirmish AI on macOS / Apple Silicon (arm64) fails at link:
On arm64, angelscript's
as_config.henables the native calling convention(
AS_ARM64), soas_callfunc_arm64.cppreferences theCallARM64/GetHFAReturn*symbols. Those are defined in a hand-written assembly stub
(
as_callfunc_arm64_xcode.S), but the Skirmish AI source glob only collectsC/C++ sources, so no
.Sis ever compiled and the symbols are undefined.(This only affects arm64; on x86_64 angelscript uses inline-asm
.cpp, which theglob already picks up — so this never surfaced on the usual Linux/x86_64 builds.)
Fix
On
APPLE AND arm64,enable_language(ASM)and addsrc/lib/angelscript/source/as_callfunc_arm64_xcode.Sto the sources.The xcode variant is required (not
_gcc.S) because Mach-O prefixes symbolswith a leading underscore (
_CallARM64) regardless of compiler — it's an objectformat concern, not a compiler one.
Verification
Built on macOS / Apple Silicon with Homebrew GCC 16:
as_callfunc_arm64_xcode.Scompiles,
SkirmishAI.dyliblinks with no undefined symbols, and the engine'sspring-headlesslinks cleanly with the AIs enabled (-DAI_TYPES=NATIVE).Assisted by Claude Code; verified by building on macOS.