Skip to content

Commit 879ec7d

Browse files
authored
Fix Xcode 27 lipo verification failure for Darwin frameworks (flutter#188625)
This PR fixes a blocking build failure encountered when building iOS and macOS apps using the Xcode 27 toolchain. *List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.* Fixes flutter#188346, flutter#188461 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 990e440 commit 879ec7d

3 files changed

Lines changed: 24 additions & 26 deletions

File tree

‎packages/flutter_tools/lib/src/build_system/targets/darwin.dart‎

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,22 @@ abstract class UnpackDarwin extends Target {
8080
]);
8181
final lipoInfo = infoResult.stdout as String;
8282

83-
final ProcessResult verifyResult = await environment.processManager.run(<String>[
84-
'lipo',
85-
frameworkBinaryPath,
86-
'-verify_arch',
87-
...archList,
88-
]);
89-
90-
if (verifyResult.exitCode != 0) {
91-
throw Exception(
92-
'Binary $frameworkBinaryPath does not contain architectures "$archs".\n'
93-
'\n'
94-
'lipo -info:\n'
95-
'$lipoInfo',
96-
);
83+
for (final arch in archList) {
84+
final ProcessResult verifyResult = await environment.processManager.run(<String>[
85+
'lipo',
86+
frameworkBinaryPath,
87+
'-verify_arch',
88+
arch,
89+
]);
90+
91+
if (verifyResult.exitCode != 0) {
92+
throw Exception(
93+
'Binary $frameworkBinaryPath does not contain architecture "$arch" (expected "$archs").\n'
94+
'\n'
95+
'lipo -info:\n'
96+
'$lipoInfo',
97+
);
98+
}
9799
}
98100

99101
// Skip thinning for non-fat executables.

‎packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,10 +1030,7 @@ void main() {
10301030
command: <String>['lipo', '-info', binary.path],
10311031
stdout: 'Architectures in the fat file:',
10321032
),
1033-
FakeCommand(
1034-
command: <String>['lipo', binary.path, '-verify_arch', 'arm64', 'x86_64'],
1035-
exitCode: 1,
1036-
),
1033+
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'arm64'], exitCode: 1),
10371034
]);
10381035

10391036
await expectLater(
@@ -1043,7 +1040,7 @@ void main() {
10431040
(Exception exception) => exception.toString(),
10441041
'description',
10451042
contains(
1046-
'does not contain architectures "arm64 x86_64".\n\n'
1043+
'does not contain architecture "arm64" (expected "arm64 x86_64").\n\n'
10471044
'lipo -info:\nArchitectures in the fat file:',
10481045
),
10491046
),
@@ -1070,7 +1067,8 @@ void main() {
10701067
command: <String>['lipo', '-info', binary.path],
10711068
stdout: 'Architectures in the fat file:',
10721069
),
1073-
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'arm64', 'x86_64']),
1070+
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'arm64']),
1071+
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'x86_64']),
10741072
FakeCommand(
10751073
command: <String>[
10761074
'lipo',
@@ -1234,7 +1232,8 @@ void main() {
12341232
command: <String>['lipo', '-info', binary.path],
12351233
stdout: 'Architectures in the fat file:',
12361234
),
1237-
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'arm64', 'x86_64']),
1235+
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'arm64']),
1236+
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'x86_64']),
12381237
FakeCommand(
12391238
command: <String>[
12401239
'lipo',

‎packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,7 @@ void main() {
251251
processManager.addCommands(<FakeCommand>[
252252
copyFrameworkCommand,
253253
lipoInfoFatCommand,
254-
FakeCommand(
255-
command: <String>['lipo', binary.path, '-verify_arch', 'arm64', 'x86_64'],
256-
exitCode: 1,
257-
),
254+
FakeCommand(command: <String>['lipo', binary.path, '-verify_arch', 'arm64'], exitCode: 1),
258255
]);
259256

260257
await expectLater(
@@ -264,7 +261,7 @@ void main() {
264261
(Exception exception) => exception.toString(),
265262
'description',
266263
contains(
267-
'does not contain architectures "arm64 x86_64".\n\nlipo -info:\nArchitectures in the fat file:',
264+
'does not contain architecture "arm64" (expected "arm64 x86_64").\n\nlipo -info:\nArchitectures in the fat file:',
268265
),
269266
),
270267
),

0 commit comments

Comments
 (0)