Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Android NDK to r23 LTS #15

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

madmiraal
Copy link
Contributor

Upgrades Android NDK to the current supported LTS version: r23c.

There had been some significant changes over the years; so I used the Build System Maintainers Guide to get everything working again; and ultimately simplify things considerably. The key changes needed include:

  1. There are no longer independent architecture based toolchains.
  2. The only architecture based tool is now the assembler compiler: as.
  3. LLD is now the default linker.
  4. Clang will automatically select the sysroot; so it's no longer necessary to include sysroot header and library directories explicitly.
  5. Clang will automatically link to the libc++ STL, and build systems should prefer to let Clang link the STL.
  6. Clang automatically enables NEON, so -mfpu=neon is not needed when compiling (only -mfpu=vfpv3-d16 is needed if NEON is not required) Note: NDK r23 is the last version that will support disabling NEON. This option has already been removed from master, but it's still available on the 3.x branch.

I also made some additional changes:

  1. I deleted everything associated with building Android on Windows (using Mingw), because, not only was this not working anyway (so it's all dead code) we should now be using clang.
  2. This in turn allowed me to remove create(env), which was only being used by Android.
  3. I removed the old check for the Travis CCACHE environmental variable.
  4. I removed the deprecated use of the environmental variable ANDROID_HOME.
  5. I removed the always overriden use of the environmental variable ANDROID_NDK_ROOT as an option.
  6. This in turn allowed me to remove the code used to determine the NDK version from this option.
  7. I removed the always True variable can_vectorize
  8. I set the default architecture to arm64v8 to match the version used in the Java code.
  9. The build system maintainers guide states that targets prior to Android API 24 (not 21) need the -mstackrealign compile flag to properly align stacks for global constructors.
  10. When optimizing for size, -Oz not -Os optimization mode is used. Note: Clang's -Oz is similar to GCC's -Os. Clang's -Os provides a more middle ground option between size and speed.
  11. I removed --fix-cortex-a8 for armv7 builds, because it only applied to Thumb builds, which are not been created, and, as far a I know, Clang would now automatically apply this fix anyway.
  12. I removed the -Wl,-z,noexecstack and -Wl,-z,relro linker options, because they are the default with LLD.

Rebel version of godotengine/godot#61691 and godotengine/godot#61692 to implement godotengine/godot#44055.

@madmiraal madmiraal self-assigned this Oct 20, 2023
@madmiraal madmiraal merged commit 781ce71 into RebelToolbox:main Oct 21, 2023
13 checks passed
@madmiraal madmiraal deleted the android-ndk-23 branch October 21, 2023 05:36
@madmiraal madmiraal added the PR Type: Maintenance Your current game will be updated. label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR Type: Maintenance Your current game will be updated.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant