diff --git a/docs/changelogs/Changelog-r26.md b/docs/changelogs/Changelog-r26.md index 3ccb3a82..0c91c793 100644 --- a/docs/changelogs/Changelog-r26.md +++ b/docs/changelogs/Changelog-r26.md @@ -11,6 +11,13 @@ directly, see the [build system maintainers guide]. [Android Studio site]: http://tools.android.com/filing-bugs [build system maintainers guide]: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md +## Announcements + +* KitKat (APIs 19 and 20) is no longer supported. The minimum OS supported by + the NDK is Lollipop (API level 21). See [Issue 1751] for details. + +[Issue 1751]: https://github.com/android/nßdk/issues/1751 + ## Changes ## Known Issues diff --git a/meta/platforms.json b/meta/platforms.json index 43806966..824bb802 100644 --- a/meta/platforms.json +++ b/meta/platforms.json @@ -1,5 +1,5 @@ { - "min": 19, + "min": 21, "max": 33, "aliases": { "20": 19, diff --git a/ndk/abis.py b/ndk/abis.py index c577da80..a710d9e4 100644 --- a/ndk/abis.py +++ b/ndk/abis.py @@ -121,13 +121,13 @@ def clang_target(arch: Arch, api: Optional[int] = None) -> str: def min_api_for_abi(abi: Abi) -> int: """Returns the minimum supported build API for the given ABI. - >>> min_api_for_abi('arm64-v8a') + >>> min_api_for_abi(Abi('arm64-v8a')) 21 - >>> min_api_for_abi('armeabi-v7a') - 19 + >>> min_api_for_abi(Abi('armeabi-v7a')) + 21 - >>> min_api_for_abi('foobar') + >>> min_api_for_abi(Abi('foobar')) Traceback (most recent call last): ... ValueError: Invalid ABI: foobar diff --git a/ndk/checkbuild.py b/ndk/checkbuild.py index 9088c8c0..13736f4d 100755 --- a/ndk/checkbuild.py +++ b/ndk/checkbuild.py @@ -813,7 +813,6 @@ class Libcxx(ndk.builds.Module): notice_group = ndk.builds.NoticeGroup.TOOLCHAIN deps = { "base-toolchain", - "libandroid_support", "ndk-build", "ndk-build-shortcut", } @@ -1501,7 +1500,6 @@ class BaseToolchain(ndk.builds.Module): notice_group = ndk.builds.NoticeGroup.TOOLCHAIN deps = { "clang", - "libandroid_support", "make", "platforms", "sysroot", @@ -1513,7 +1511,6 @@ class BaseToolchain(ndk.builds.Module): def notices(self) -> Iterator[Path]: yield from Clang().notices yield from Yasm().notices - yield from LibAndroidSupport().notices yield from Platforms().notices yield from Sysroot().notices yield from SystemStl().notices @@ -1524,7 +1521,6 @@ def build(self) -> None: def install(self) -> None: install_dir = self.get_install_path() yasm_dir = self.get_dep("yasm").get_install_path() - libandroid_support_dir = self.get_dep("libandroid_support").get_install_path() platforms_dir = self.get_dep("platforms").get_install_path() sysroot_dir = self.get_dep("sysroot").get_install_path() system_stl_dir = self.get_dep("system-stl").get_install_path() @@ -1577,19 +1573,6 @@ def install(self) -> None: system_stl_inc_dst = system_stl_hdr_dir / "4.9.x" shutil.copytree(system_stl_inc_src, system_stl_inc_dst) - # $SYSROOT/usr/local/include comes before $SYSROOT/usr/include, so we - # can use that for libandroid_support's headers. Puting them here - # *does* mean that libandroid_support's headers get used even when - # we're not using libandroid_support, but they should be a no-op for - # android-21+ and in the case of pre-21 without libandroid_support - # (libstdc++), we're only degrading the UX; the user will get a linker - # error instead of a compiler error. - support_hdr_dir = install_dir / "sysroot/usr/local" - support_hdr_dir.mkdir(parents=True) - support_inc_src = libandroid_support_dir / "include" - support_inc_dst = support_hdr_dir / "include" - shutil.copytree(support_inc_src, support_inc_dst) - @register class Vulkan(ndk.builds.Module): @@ -1679,8 +1662,6 @@ def install(self) -> None: "libc++_static.a", "libc++abi.a", ] - if abi in ndk.abis.LP32_ABIS: - static_libs.append("libandroid_support.a") for lib in static_libs: shutil.copy2( @@ -1689,6 +1670,7 @@ def install(self) -> None: platforms = self.get_dep("platforms") assert isinstance(platforms, Platforms) + # Also install a libc++.so and libc++.a linker script per API level. for api in platforms.get_apis(): if api in Platforms.skip_apis: continue @@ -1697,25 +1679,8 @@ def install(self) -> None: triple = ndk.abis.arch_to_triple(arch) dst_dir = install_dir / "sysroot/usr/lib" / triple / str(api) - # Also install a libc++.so and libc++.a linker script per API - # level. We need this to be done on a per-API level basis - # because libandroid_support is only used on pre-21 API levels. static_script = ["-lc++_static", "-lc++abi"] shared_script = ["-lc++_shared"] - if api < 21: - # The ordering here is funky because of interdependencies - # between libandroid_support and libc++abi. - # libandroid_support needs new/delete from libc++abi but - # libc++abi needs posix_memalign from libandroid_support. - static_script.extend( - [ - "-landroid_support", - "-lc++abi", - # TODO: Remove once API 16 is no longer supported. - "-landroid_support", - ] - ) - shared_script.insert(0, "-landroid_support") libcxx_so_path = dst_dir / "libc++.so" with open(libcxx_so_path, "w") as script: @@ -1920,13 +1885,6 @@ class SystemStl(ndk.builds.PackageModule): src = NDK_DIR / "sources/cxx-stl/system" -@register -class LibAndroidSupport(ndk.builds.PackageModule): - name = "libandroid_support" - install_path = Path("sources/android/support") - src = NDK_DIR / "sources/android/support" - - @register class Libcxxabi(ndk.builds.PackageModule): name = "libc++abi" diff --git a/tests/build/cmake_api_pull_up/__init__.py b/tests/build/cmake_api_pull_up/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/build/cmake_api_pull_up/project/CMakeLists.txt b/tests/build/cmake_api_pull_up/project/CMakeLists.txt deleted file mode 100644 index ddcd3536..00000000 --- a/tests/build/cmake_api_pull_up/project/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 3.6) -project(ApiLevelPullUpTest CXX) - -add_library(foo SHARED foo.cpp) diff --git a/tests/build/cmake_api_pull_up/project/foo.cpp b/tests/build/cmake_api_pull_up/project/foo.cpp deleted file mode 100644 index b876b5c8..00000000 --- a/tests/build/cmake_api_pull_up/project/foo.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#if __ANDROID_API__ != 21 -#error API level was not pulled up to 21 -#endif diff --git a/tests/build/cmake_api_pull_up/test.py b/tests/build/cmake_api_pull_up/test.py deleted file mode 100644 index c1906e47..00000000 --- a/tests/build/cmake_api_pull_up/test.py +++ /dev/null @@ -1,68 +0,0 @@ -# -# Copyright (C) 2021 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -"""Check that pre-LP64 API levels are correctly pulled-up for CMake.""" -from pathlib import Path -import re -import subprocess - -from ndk.cmake import find_cmake, find_ninja -from ndk.test.spec import BuildConfiguration, CMakeToolchainFile - - -def run_test(ndk_path: str, config: BuildConfiguration) -> tuple[bool, str]: - """Check that pre-LP64 API levels are correctly pulled-up for CMake.""" - cmake = find_cmake() - ninja = find_ninja() - toolchain_path = Path(ndk_path) / 'build/cmake/android.toolchain.cmake' - project_path = 'project' - if config.toolchain_file is CMakeToolchainFile.Legacy: - toolchain_mode = 'ON' - else: - toolchain_mode = 'OFF' - - test_inputs = ( - '-DANDROID_PLATFORM=19', - '-DANDROID_PLATFORM=android-19', - '-DANDROID_NATIVE_API_LEVEL=19', - '-DANDROID_NATIVE_API_LEVEL=android-19', - ) - - for arg in test_inputs: - cmake_cmd = [ - str(cmake), - f'-DCMAKE_TOOLCHAIN_FILE={toolchain_path}', - f'-DANDROID_ABI={config.abi}', - arg, - f'-DCMAKE_MAKE_PROGRAM={ninja}', - f'-DANDROID_USE_LEGACY_TOOLCHAIN_FILE={toolchain_mode}', - '-GNinja', - ] - result = subprocess.run(cmake_cmd, - check=False, - cwd=project_path, - capture_output=True, - text=True) - if result.returncode != 0: - return False, result.stdout - if config.toolchain_file is CMakeToolchainFile.Default: - expected = re.compile( - r'android-19 is not supported.*' - r'Using minimum supported LP64 version 21.') - if not expected.search(result.stdout): - return False, (f'expected pattern "{expected.pattern}" is ' - f'missing from cmake output:\n{result.stdout}') - - return True, '' diff --git a/tests/build/cmake_api_pull_up/test_config.py b/tests/build/cmake_api_pull_up/test_config.py deleted file mode 100644 index 3c08c53d..00000000 --- a/tests/build/cmake_api_pull_up/test_config.py +++ /dev/null @@ -1,10 +0,0 @@ -from typing import Optional - -from ndk.abis import LP32_ABIS -from ndk.test.buildtest.case import Test - - -def build_unsupported(test: Test) -> Optional[str]: - if test.config.abi in LP32_ABIS: - return test.config.abi - return None diff --git a/tests/device/emutls-dealloc/test_config.py b/tests/device/emutls-dealloc/test_config.py new file mode 100644 index 00000000..cd33f8ef --- /dev/null +++ b/tests/device/emutls-dealloc/test_config.py @@ -0,0 +1,10 @@ +from typing import Optional +from ndk.abis import Abi +from ndk.test.devices import Device +from ndk.test.devicetest.case import TestCase + + +def run_broken(test: TestCase, device: Device) -> tuple[Optional[str], Optional[str]]: + if device.version == 21 and test.config.abi == Abi("armeabi-v7a"): + return f"{device.version}", "https://github.com/android/ndk/issues/1753" + return None, None