Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0886c7d

Browse files
authored
Narrow the scope of the Windows Android arm hack (#37125)
1 parent 9c45b0e commit 0886c7d

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ allowed_hosts = [
118118
]
119119

120120
deps = {
121-
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ad96f00615dc306c22cc09d433eee50392f8033c',
121+
'src': 'https://github.com/flutter/buildroot.git' + '@' + '4099e11fffa406aaa13be8bd512fe5b0ad6262f6',
122122

123123
# Fuchsia compatibility
124124
#

tools/gn

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,18 @@ def to_gn_args(args):
329329
gn_args['target_cpu'] = get_target_cpu(args)
330330
gn_args['dart_target_arch'] = gn_args['target_cpu']
331331

332-
# No cross-compilation on Windows (for now). Use host toolchain that
333-
# matches the bit-width of the target architecture.
334-
if sys.platform.startswith(('cygwin', 'win')) and args.target_os != 'win':
335-
cpu = cpu_for_target_arch(gn_args['target_cpu'])
336-
# We explicitly allow arm64 native build. 'host_cpu' key may not exist.
337-
if gn_args.get('host_cpu') == 'arm64' and gn_args['target_cpu'] == 'arm64':
338-
cpu = 'arm64'
339-
gn_args['host_cpu'] = cpu
340-
gn_args['target_cpu'] = cpu
332+
# We cannot cross-compile for 32 bit arm on a Windows host. We work around
333+
# this by leaving 'target_cpu' and 'dart_target_arch' set to 'arm' so that
334+
# Dart tools such as gen_snapshot that are built for the host will correctly
335+
# target arm, but we hardcode the 'current_cpu' to always be the host arch
336+
# so that the GN build doesn't go looking for a Windows arm toolchain, which
337+
# does not exist. Further, we set the 'host_cpu' so that it shares the
338+
# bitwidth of the 32-bit arm target.
339+
if sys.platform.startswith(
340+
('cygwin', 'win')
341+
) and args.target_os == 'android' and gn_args['target_cpu'] == 'arm':
342+
gn_args['host_cpu'] = 'x86'
343+
gn_args['current_cpu'] = 'x86'
341344

342345
if is_host_build(args) and gn_args['host_os'] == 'mac':
343346
# macOS host builds (whether x64 or arm64) must currently be built under

0 commit comments

Comments
 (0)