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 #61691

Merged
merged 1 commit into from
Jun 26, 2022
Merged

Conversation

madmiraal
Copy link
Contributor

@madmiraal madmiraal commented Jun 4, 2022

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

There have been some significant changes over the years; so I've 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've also made some additional changes:

  1. I've 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. I'll leave getting Android builds working on Windows for a separate PR. Edit: PR updated to include building Android on Windows.
  2. This in turn allowed me to remove create(env), which was only being used by Android.
  3. I've removed the old check for the Travis CCACHE environmental variable.
  4. I've removed the deprecated use of the environmental variable ANDROID_HOME.
  5. I've 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've removed the always True variable can_vectorize
  8. I've 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've 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've removed the -Wl,-z,noexecstack and -Wl,-z,relro linker options, because they are the default with LLD.

Closes #44055.

platform/android/detect.py Outdated Show resolved Hide resolved
platform/android/java/app/config.gradle Outdated Show resolved Hide resolved
Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave getting Android builds working on Windows for a separate PR

Is there a reason for separating the PRs instead of having them together? I'm worried this would lead to broken workflows for some developers, and a flurry of bugs that would be moot on the second PR lands.



def get_android_ndk_root(env):
return env["ANDROID_SDK_ROOT"] + "/ndk/" + get_ndk_version()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for using get_env_android_sdk_root() in some places and env["ANDROID_SDK_ROOT"] in others?

@madmiraal
Copy link
Contributor Author

I'll leave getting Android builds working on Windows for a separate PR

Is there a reason for separating the PRs instead of having them together? I'm worried this would lead to broken workflows for some developers, and a flurry of bugs that would be moot on the second PR lands.

Building Android on Windows is not working at the moment (or at least I'm unable to build Android on Windows) so this PR won't break any workflows that aren't broken already.

Is there a reason for using get_env_android_sdk_root() in some places and env["ANDROID_SDK_ROOT"] in others?

get_env_android_sdk_root() extracts the Android SDK path from the environmental variable. Once we have access to the SCons env we save it in env["ANDROID_SDK_ROOT"] and we use the saved copy during the rest of the build process. However, until we have access to the SCons env we need to extract it from the environmental variable each time using get_env_android_sdk_root().

@m4gr3d
Copy link
Contributor

m4gr3d commented Jun 7, 2022

Building Android on Windows is not working at the moment (or at least I'm unable to build Android on Windows) so this PR won't break any workflows that aren't broken already.

I'm doing Android development (e.g: building Godot Android shared libraries, apk & build templates, developing and testing the Godot Editor) on Windows (and MacOs) without any issues.

What build issues are you running into?

@madmiraal
Copy link
Contributor Author

madmiraal commented Jun 8, 2022

When I run scons platform=android I get:

scons: Reading SConscript files ...
Checking for Android NDK...
Could not read source prop file 'C:\Users\Marcel\AppData\Local\Android\Sdk/ndk/21.4.7075529\source.properties'
Installing Android NDK...

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
CalledProcessError: Command '['C:\\Users\\Marcel\\AppData\\Local\\Android\\Sdk/cmdline-tools/latest/bin/sdkmanager.bat', 'ndk;21.4.7075529']' returned non-zero exit status 1.:
  File "C:\Users\Marcel\Git\godot-3.x\SConstruct", line 431:
    detect.configure(env)
  File "C:\Users\Marcel\Git\godot-3.x\./platform/android\detect.py", line 93:
    install_ndk_if_needed(env)
  File "C:\Users\Marcel\Git\godot-3.x\./platform/android\detect.py", line 86:
    subprocess.check_call([sdkmanager_path, ndk_download_args])
  File "C:\Users\Marcel\scoop\apps\python\current\lib\subprocess.py", line 369:
    raise CalledProcessError(retcode, cmd)

I initially assumed that it simply wasn't working on Windows, because of the mix between forward slashes and backward slashes in the command. However, looking into it a bit further, I've noticed a few things:

  1. If I install the NDK manually, I am able to compile Godot for Android on Windows. :-)
  2. On Linux, if I install Anroid Studio, I don't get the cmdline-tools, so without the correct NDK, this doesn't work on Linux either:
scons: Reading SConscript files ...
Checking for Android NDK...
Could not read source prop file '/home/marcel/Android/Sdk/ndk/21.4.7075529/source.properties'
Installing Android NDK...
FileNotFoundError: [Errno 2] No such file or directory: '/home/marcel/Android/Sdk/cmdline-tools/latest/bin/sdkmanager':
  File "/home/marcel/Git/godot-3.x/SConstruct", line 431:
    detect.configure(env)
  File "/home/marcel/Git/godot-3.x/./platform/android/detect.py", line 93:
    install_ndk_if_needed(env)
  File "/home/marcel/Git/godot-3.x/./platform/android/detect.py", line 86:
    subprocess.check_call([sdkmanager_path, ndk_download_args])
  File "/usr/lib/python3.10/subprocess.py", line 364:
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 345:
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.10/subprocess.py", line 966:
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1842:
    raise child_exception_type(errno_num, err_msg, err_filename)

So just having a path to the Android SDK root isn't sufficient.

I'll update this PR to get it to work with Windows, and include some improvements to fix or at least provide better error messages for these issues too. I don't have a Macos machine, but, unless you tell me otherwise, from what I can tell, I assume it works the same as a Linux install.

@akien-mga
Copy link
Member

Thanks a lot for working on this - being stuck on r21 was starting to be a bother and the re-implemented NDK build config in detect.py is a hassle to maintain.

@madmiraal madmiraal force-pushed the android-ndk-23 branch 3 times, most recently from 5b730ba to feb6224 Compare June 11, 2022 14:03
@madmiraal
Copy link
Contributor Author

Updated to also compile on Windows.

@akien-mga
Copy link
Member

akien-mga commented Jun 22, 2022

For the record, the timing is a bit short as we're already at 3.5 RC 4, but I'm thinking that it would be worth spending the time to get this reviewed, tested and merged for 3.5, together with #51815 which is needed for new Google Play requirements (notably for target SDK 31, but also past requirements for general storage support).

I'm testing an update of the official build containers to use NDK r23 and Android 32, so far I'm running into issues building Mono which might complicate things. I'll update when I've spent some more time on it. Then I'm planning to make a test build with #44055 + #51815 and ask Android users to test this thoroughly ASAP so we can assess if it's worth delaying 3.5 to make sure we get those in (so first a custom testing build, then if it works we merge and release 3.5 RC 5).

So far I can confirm that this PR builds fine on Linux for me without any custom change to my SDK/NDK setup (the new NDK is downloaded by gradle as expected).

@akien-mga
Copy link
Member

akien-mga commented Jun 22, 2022

I'm running into some issues getting godot-mono-builds to compile Mono for Android with NDK r23, as it also has some references to old armv5- prefixes and prefix + "-gcc" binaries (and -ar, -ranlib, maybe more). Opened an issue with my current progress there (very much trial and error, a more thorough review of the whole setup as done here would be great): godotengine/godot-mono-builds#68

@m4gr3d
Copy link
Contributor

m4gr3d commented Jun 22, 2022

@madmiraal The update works fine on Windows, but I'm running into build (linking) errors on macos:

[Initial build] Linking Shared Library ==> bin/libgodot.android.opt.debug.armv8.so
ld: error: undefined symbol: String::utf8() const
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(_remove_symlink(String const&))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::open_dynamic_library(String, void*&, bool))
>>> referenced by file_access_android.cpp
>>>               platform/android/file_access_android.os:(FileAccessAndroid::_open(String const&, int))
>>> referenced 16 more times

ld: error: undefined symbol: CharString::get_data() const
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(_remove_symlink(String const&))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::open_dynamic_library(String, void*&, bool))
>>> referenced by file_access_android.cpp
>>>               platform/android/file_access_android.os:(FileAccessAndroid::_open(String const&, int))
>>> referenced 18 more times

ld: error: undefined symbol: Memory::free_static(void*, bool)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(_remove_symlink(String const&))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::get_video_driver_name(int) const)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::get_video_driver_name(int) const)
>>> referenced 400 more times

ld: error: undefined symbol: String::String(char const*)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(_remove_symlink(String const&))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::get_video_driver_name(int) const)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced 85 more times

ld: error: undefined symbol: itos(long)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::get_video_driver_name(int) const)

ld: error: undefined symbol: operator+(char const*, String const&)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::get_video_driver_name(int) const)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::open_dynamic_library(String, void*&, bool))
>>> referenced by dir_access_jandroid.cpp
>>>               platform/android/dir_access_jandroid.os:(DirAccessJAndroid::get_current_dir())
>>> referenced 6 more times

ld: error: undefined symbol: String::operator+(String const&) const
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::get_video_driver_name(int) const)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::open_dynamic_library(String, void*&, bool))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::open_dynamic_library(String, void*&, bool))
>>> referenced 3 more times

ld: error: undefined symbol: _err_print_error(char const*, char const*, int, char const*, String const&, ErrorHandlerType)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::get_video_driver_name(int) const)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::open_dynamic_library(String, void*&, bool))
>>> referenced by java_godot_lib_jni.cpp
>>>               platform/android/java_godot_lib_jni.os:(Java_org_godotengine_godot_GodotLib_setup)
>>> referenced 1 more times

ld: error: undefined symbol: OS_Unix::initialize_core()
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize_core())

ld: error: undefined symbol: FileAccess::create_func
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize_core())
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize_core())

ld: error: undefined symbol: DirAccess::create_func
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize_core())
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize_core())

ld: error: undefined symbol: ProjectSettings::get_singleton()
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by java_godot_lib_jni.cpp
>>>               platform/android/java_godot_lib_jni.os:(Java_org_godotengine_godot_GodotLib_setup)
>>> referenced 6 more times

ld: error: undefined symbol: StringName::StringName(char const*)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by android_input_handler.cpp
>>>               platform/android/android_input_handler.os:(AndroidInputHandler::process_key_event(int, int, int, bool))
>>> referenced 8 more times

ld: error: undefined symbol: Object::get(StringName const&, bool*) const
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by java_godot_lib_jni.cpp
>>>               platform/android/java_godot_lib_jni.os:(Java_org_godotengine_godot_GodotLib_setup)
>>> referenced 2 more times

ld: error: undefined symbol: Variant::Variant(char const*)
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))

ld: error: undefined symbol: Variant::operator==(Variant const&) const
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))

ld: error: undefined symbol: Variant::clear()
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced 57 more times

ld: error: undefined symbol: StringName::~StringName()
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by android_input_handler.cpp
>>>               platform/android/android_input_handler.os:(AndroidInputHandler::process_key_event(int, int, int, bool))
>>> referenced 79 more times

ld: error: undefined symbol: RasterizerGLES3::is_viable()
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))

ld: error: undefined symbol: Variant::operator bool() const
>>> referenced by os_android.cpp
>>>               platform/android/os_android.os:(OS_Android::initialize(OS::VideoMode const&, int, int))
>>> referenced by jni_utils.cpp
>>>               platform/android/jni_utils.os:(_variant_to_jvalue(_JNIEnv*, Variant::Type, Variant const*, bool))

ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/libgodot.android.opt.debug.armv8.so] Error 1
scons: building terminated because of errors.

@madmiraal
Copy link
Contributor Author

@m4gr3d I don't have a Macos machine to test this. To help troubleshoot what's missing, please provide the link call that is failing i.e. using the verbose=yes option in your Scons call.

@akien-mga
Copy link
Member

I made a test build of the 3.x PR for NDK r23 + Android scoped storage, linked in #51815 (comment)

So that confirms that it works fine for the official buildsystem once upgraded to the latest NDK and build tools. Now we have to see if the binaries actually work as intended (and it's only the standard build since so far we couldn't build Mono with the new NDK, which might be a deal breaker for 3.5-stable).

@akien-mga
Copy link
Member

As suggested by @neikeq, it seems we can keep building Mono for Android with NDK r21 and build Godot with NDK r23. I did a test build with that setup and it seems functional in a quick test: https://downloads.tuxfamily.org/godotengine/testing/3.5-rc-android-scoped%2bndk23/mono/

So that shouldn't be a blocker anymore. We just need to figure out the macOS linking issue that @m4gr3d reported.

Faless
Faless previously requested changes Jun 25, 2022
Copy link
Collaborator

@Faless Faless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comments, for a possible fix to the MacOS issue.

SConstruct Show resolved Hide resolved
Comment on lines 157 to 161
env["CC"] = compiler_path + "/clang"
env["CXX"] = compiler_path + "/clang++"
env["AR"] = compiler_path + "/llvm-ar"
env["AS"] = bin_utils_path + "/as"
Copy link
Collaborator

@Faless Faless Jun 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env["CC"] = compiler_path + "/clang"
env["CXX"] = compiler_path + "/clang++"
env["AR"] = compiler_path + "/llvm-ar"
env["AS"] = bin_utils_path + "/as"
env["CC"] = toolchain + "/bin/clang"
env["CXX"] = toolchain + "/bin/clang++"
env["AR"] = toolchain + "/bin/llvm-ar"
env["AS"] = toolchain + "/bin/llvm-as"
env["LD"] = toolchain + "/bin/llvm-ld"
env["STRIP"] = toolchain + "/bin/llvm-strip"
env["RANLIB"] = toolchain + "/bin/llvm-ranlib"

See the android part of: godotengine/godot-cpp#762

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was defaulting to use the builtin ranlib:

ranlib core/libcore.android.debug.armv8.a
warning: /Applications/Xcode_13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: core/libcore.android.debug.armv8.a the table of contents is empty (no object file members in the library define global symbols)

There appears to be a known issue with using XCode's ranlib against a library created using llvm-ar: llvm/llvm-project#34156

@Faless
Copy link
Collaborator

Faless commented Jun 25, 2022

The custom tools is necessary for that very reason. On Windows it defaults to configuring everything for Visual Studio.

That should only happen if you pass the msvc tool (or do not pass the tools option).
Passing an empty array to env_base = Environment(tools=[]), should solve that.
Then you should be able to load the custom tools you want (if any) by calling tool = base_env.Tool("toolname") (which should also apply the relevant config, in case it doesn't tool(env) will)

@madmiraal
Copy link
Contributor Author

madmiraal commented Jun 25, 2022

I've updated the build to use:

env["RANLIB"] = toolchain + "/bin/llvm-ranlib"

I've tested it across all three operating systems (ubuntu, windows and macos), across all four android architectures and both debug and release builds and in all 24 cases it now compiles successfully: https://github.com/madmiraal/godot/actions/runs/2561015681

@Faless
Copy link
Collaborator

Faless commented Jun 25, 2022

I highly advise adding the other executables too (LD, STRIP, etc), I really see no reason for only setting a partial tool info, while inheriting from system tools, ending up with the wrong strip or ld command, which may break modules or future changes to the build system (e.g. stripping the library).

@madmiraal
Copy link
Contributor Author

It is already using the same clang++ used for compiling for linking:

/usr/local/lib/android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -o bin/libgodot.android.opt.armv7.so -target armv7a-linux-androideabi24 -Wl,--gc-sections -Wl,--no-undefined -Wl,-z,now -Wl,-soname,libgodot_android.so -shared platform/android/os_android.os platform/android/android_input_handler.os platform/android/file_access_android.os platform/android/audio_driver_opensl.os platform/android/dir_access_jandroid.os platform/android/tts_android.os platform/android/thread_jandroid.os platform/android/net_socket_android.os platform/android/java_godot_lib_jni.os platform/android/java_class_wrapper.os platform/android/java_godot_wrapper.os platform/android/java_godot_view_wrapper.os platform/android/java_godot_io_wrapper.os platform/android/jni_utils.os platform/android/android_keys_utils.os platform/android/display_server_android.os platform/android/plugin/godot_plugin_jni.os platform/android/vulkan/vulkan_context_android.os thirdparty/misc/ifaddrs-android.os main/libmain.android.opt.armv7.a modules/libmodules.android.opt.armv7.a modules/libmodule_webxr.android.opt.armv7.a modules/libmodule_websocket.android.opt.armv7.a modules/libmodule_webrtc.android.opt.armv7.a modules/libmodule_webp.android.opt.armv7.a modules/libmodule_vorbis.android.opt.armv7.a modules/libmodule_visual_script.android.opt.armv7.a modules/libmodule_vhacd.android.opt.armv7.a modules/libmodule_upnp.android.opt.armv7.a modules/libmodule_theora.android.opt.armv7.a modules/libmodule_tga.android.opt.armv7.a modules/libmodule_text_server_fb.android.opt.armv7.a modules/libmodule_text_server_adv.android.opt.armv7.a modules/libmodule_svg.android.opt.armv7.a modules/libmodule_squish.android.opt.armv7.a modules/libmodule_regex.android.opt.armv7.a modules/libmodule_ogg.android.opt.armv7.a modules/libmodule_noise.android.opt.armv7.a modules/libmodule_navigation.android.opt.armv7.a modules/libmodule_msdfgen.android.opt.armv7.a modules/libmodule_mobile_vr.android.opt.armv7.a modules/libmodule_minimp3.android.opt.armv7.a modules/libmodule_meshoptimizer.android.opt.armv7.a modules/libmodule_mbedtls.android.opt.armv7.a modules/libmodule_lightmapper_rd.android.opt.armv7.a modules/libmodule_jsonrpc.android.opt.armv7.a modules/libmodule_jpg.android.opt.armv7.a modules/libmodule_hdr.android.opt.armv7.a modules/libmodule_gridmap.android.opt.armv7.a modules/libmodule_gltf.android.opt.armv7.a modules/libmodule_glslang.android.opt.armv7.a modules/libmodule_gdscript.android.opt.armv7.a modules/libmodule_freetype.android.opt.armv7.a modules/libmodule_enet.android.opt.armv7.a modules/libmodule_dds.android.opt.armv7.a modules/libmodule_csg.android.opt.armv7.a modules/libmodule_bmp.android.opt.armv7.a modules/libmodule_basis_universal.android.opt.armv7.a platform/libplatform.android.opt.armv7.a drivers/libdrivers.android.opt.armv7.a scene/libscene.android.opt.armv7.a servers/libservers.android.opt.armv7.a core/libcore.android.opt.armv7.a modules/freetype/libfreetype_builtin.android.opt.armv7.a modules/msdfgen/libmsdfgen_builtin.android.opt.armv7.a modules/text_server_adv/libharfbuzz_builtin.android.opt.armv7.a modules/text_server_adv/libgraphite_builtin.android.opt.armv7.a modules/text_server_adv/libicu_builtin.android.opt.armv7.a -lOpenSLES -lEGL -lGLESv2 -landroid -llog -lz -ldl

There are numerous other llvm programmes that we're not using, but there doesn't appear to be an llvm-ld (It appears to just use ld) So I don't see any reason for just adding llvm-strip if it's not being used.

@Faless
Copy link
Collaborator

Faless commented Jun 26, 2022

but there doesn't appear to be an llvm-ld (It appears to just use ld)

You are right, there there is only ld: toolchains/llvm/prebuilt/linux-x86_64/bin/ld.

If it's using clang++ for linking it's fine, since clang will then call the correct link command (i.e. the one in the prebuilt toolchain, not the system one).

@m4gr3d
Copy link
Contributor

m4gr3d commented Jun 26, 2022

I can confirm the latest updates fixed the build issue on macos!

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great, it's a much needed cleanup and modernization of the SCons setup, aside from adding support for NDK r23. Works well both locally on Mageia 9 and on the official buildsystem on Fedora 36.

Thanks a lot for working on this!

@akien-mga akien-mga merged commit 898e09e into godotengine:master Jun 26, 2022
@akien-mga
Copy link
Member

Thanks!

@Faless
Copy link
Collaborator

Faless commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for compiling for Android with ndk r22+
5 participants