Skip to content

Conversation

@straight-shoota
Copy link
Member

aarch64-linux-android currently gets the unix flag, because of linux. But the alias aarch64-android does not contain linux...

@straight-shoota straight-shoota self-assigned this Nov 22, 2025
@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:codegen labels Nov 22, 2025
@ysbaddaden
Copy link
Contributor

ysbaddaden commented Nov 24, 2025

I think we ought to fix <arch>-android.* to be <arch>-linux-android.* instead.

@straight-shoota
Copy link
Member Author

We usually leave normalization to LLVM.normalize_triple. And apparently, it considers ``${arch}-linux-androidand${arch}-android` as different targets.
I'm not sure if we should still override that, although it seems reasonable to not have two different canonical android targets.
However, the question still remains, which form should we consider as canonical 🤷

This PR is just a simple fix to make the aarch64-android target work. This is necessary to make automated tests that read target triples from src/lib_c/ work.

@HertzDevil
Copy link
Contributor

HertzDevil commented Nov 24, 2025

LLVM sees android as an environment name, i.e. the fourth component of a triple, in the same category as gnu or musl, rather than an OS name. So it is more appropriate to move or symlink src/lib_c/aarch64-android to src/lib_c/aarch64-linux-android (and Crystal::Codegen::Target#os_name doesn't need a special case for Android), since those directory names are supposed to be canonical LLVM triples without the vendor component.

@straight-shoota
Copy link
Member Author

straight-shoota commented Nov 24, 2025

Yes, we can fix this particular problem from the other end as well 👍

That moves aarch64-android out of the spotlight, but still keeps open whether we should normalize it.

@straight-shoota
Copy link
Member Author

Superseded by #16409

@straight-shoota straight-shoota deleted the bug/android-unix branch November 24, 2025 14:08
@straight-shoota
Copy link
Member Author

Oh, but Target#os_name considers android as a separate operating sytems.
Thus, CrystalPath#add_target_path(codegen_target) normalizes to aarch64-android.

@ysbaddaden
Copy link
Contributor

It's an error IMO. It shall return linux-android and that would work, as long as we add an android -> linux-android symlink for older compilers.

straight-shoota added a commit that referenced this pull request Nov 26, 2025
`aarch64-linux-android` is the canonical name (#16403 (comment)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:codegen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants