Fix: stop running hl when compiling to hlc on arm64 #11783
Closed
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.
I was fiddling with Haxe/HashLink in my M1 Macbook, and when compiling HashLink from source this message was displayed:
Makefile:174: HashLink vm is not supported on arm64, skipping
I already knew that HashLink didn't have arm64 JIT and only supported
hlc
compilation, but when compiling on arm64 with this command:haxe --main Main --hl out/main.c
An error message is displayed although valid C code is generated without any problems:
Error: Library hashlink is not installed ERROR (unknown position) | Error: Build failed
It seems counterintuitive to run the
hl
binary when the architecture doesn't support it. I know if I supply-D no-compilation=true
this won't be shown, as the Haxe compiler doesn't try to runhaxelib run hashlink
(this happens on filesrc/generators/genhl.ml
around line 4305), but again, it seems counterintuitive.This fix simply checks if we are on arm64 and sets the define flag NoCompilation accordingly. If this fix is not desirable, please let me know so that I can proceed and maybe document the use of the
no-compilation
flag on the HashLink section of the Haxe manual. Thank you for the amazing language!