Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22f82067 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Revert "Use --sysroot when compiling against the NDK"

Revert submission 3312372-ndk_sysroot

Reason for revert: b/374513613

Reverted changes: /q/submissionid:3312372-ndk_sysroot

Bug: 374513613
Bug: 374130155
Change-Id: I2c17d085d090fd5a9b8bae4bf6c3a0e43128ad4c
parent 2757bb74
Loading
Loading
Loading
Loading
+6 −14
Original line number Diff line number Diff line
@@ -2734,11 +2734,6 @@ func TestIncludeDirsExporting(t *testing.T) {

func TestIncludeDirectoryOrdering(t *testing.T) {
	t.Parallel()

	expectedPlatformFlags := []string{
		"-nostdlibinc",
	}

	baseExpectedFlags := []string{
		"${config.ArmThumbCflags}",
		"${config.ArmCflags}",
@@ -2800,9 +2795,9 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
	cstd := []string{"-std=gnu17", "-std=conly"}
	cppstd := []string{"-std=gnu++20", "-std=cpp", "-fno-rtti"}

	lastNDKFlags := []string{
		"--sysroot",
		"out/soong/ndk/sysroot",
	lastNDKIncludes := []string{
		"out/soong/ndk/sysroot/usr/include",
		"out/soong/ndk/sysroot/usr/include/arm-linux-androideabi",
	}

	lastPlatformIncludes := []string{
@@ -2826,11 +2821,10 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
				expectedNDKSTLIncludes,
				cflags,
				cstd,
				lastNDKFlags,
				lastNDKIncludes,
				[]string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"},
			),
			expectedPlatform: slices.Concat(
				expectedPlatformFlags,
				baseExpectedFlags,
				expectedTargetPlatformFlags,
				conly,
@@ -2852,11 +2846,10 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
				expectedNDKSTLIncludes,
				cflags,
				cppstd,
				lastNDKFlags,
				lastNDKIncludes,
				[]string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"},
			),
			expectedPlatform: slices.Concat(
				expectedPlatformFlags,
				baseExpectedFlags,
				expectedTargetPlatformFlags,
				cppOnly,
@@ -2876,10 +2869,9 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
				[]string{"${config.CommonGlobalAsflags}"},
				expectedIncludes,
				expectedNDKSTLIncludes,
				lastNDKFlags,
				lastNDKIncludes,
			),
			expectedPlatform: slices.Concat(
				expectedPlatformFlags,
				baseExpectedFlags,
				expectedTargetPlatformFlags,
				[]string{"${config.CommonGlobalAsflags}"},
+3 −3
Original line number Diff line number Diff line
@@ -430,14 +430,14 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
	}

	if ctx.useSdk() {
		// TODO: Switch to --sysroot.
		// The NDK headers are installed to a common sysroot. While a more
		// typical Soong approach would be to only make the headers for the
		// library you're using available, we're trying to emulate the NDK
		// behavior here, and the NDK always has all the NDK headers available.
		flags.SystemIncludeFlags = append(flags.SystemIncludeFlags,
			"--sysroot "+getNdkSysrootBase(ctx).String())
	} else if ctx.Device() {
		flags.Global.CommonFlags = append(flags.Global.CFlags, "-nostdlibinc")
			"-isystem "+getCurrentIncludePath(ctx).String(),
			"-isystem "+getCurrentIncludePath(ctx).Join(ctx, config.NDKTriple(tc)).String())
	}

	if ctx.InVendorOrProduct() {
+1 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ var (
		"-Werror=address",
		"-Werror=sequence-point",
		"-Werror=format-security",
		"-nostdlibinc",
	}

	commonGlobalLldflags = []string{