-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listplatform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiont: xcode"xcodebuild" on iOS and general Xcode project management"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Steps to reproduce
- Create a Flutter project with iOS support
- Add CocoaPods dependencies (Firebase, etc.)
- Run
pod installin theiosdirectory - Open the project in Xcode
- Attempt to archive the project (Product → Archive)
- Build fails with "Improperly formatted define flag" error
Expected results
The archive should complete successfully, as it does in Flutter 3.35.7.
Actual results
Archive build fails with the following error:
Improperly formatted define flag: Failed to package /path/to/project.
Command PhaseScriptExecution failed with a nonzero exit code
The error occurs during the "Run Script" build phase that executes:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
Build Log Details
The build log shows that OTHER_SWIFT_FLAGS and GCC_PREPROCESSOR_DEFINITIONS are being expanded with leading spaces:
export OTHER_SWIFT_FLAGS\=\ -DCOCOAPODS
export GCC_PREPROCESSOR_DEFINITIONS\=\ COCOAPODS=1 ...
Note the double space after the = sign, which appears to be causing the Flutter build script to fail.
Additional Context
- No code changes were made between testing 3.35.7 and 3.38.0
- The issue appears to be related to how Flutter 3.38.0's
xcode_backend.shscript processes build settings with define flags - The error specifically occurs during the archive process, not during regular builds
- The project uses CocoaPods with dependencies including Firebase, VeriffSDK, and other iOS frameworks
Code sample
Code sample
[Paste your code here]Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
Improperly formatted define flag: Failed to package /path/to/project.
Command PhaseScriptExecution failed with a nonzero exit codeThe error occurs during the "Run Script" build phase that executes:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
Build Log Details
The build log shows that OTHER_SWIFT_FLAGS and GCC_PREPROCESSOR_DEFINITIONS are being expanded with leading spaces:
export OTHER_SWIFT_FLAGS\=\ -DCOCOAPODS
export GCC_PREPROCESSOR_DEFINITIONS\=\ COCOAPODS=1 ...
Note the double space after the = sign, which appears to be causing the Flutter build script to fail.
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.38.0, on macOS 26.1 25B78 darwin-arm64, locale
en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.1.1)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!bubnov, large, IsaacMauricio, doudar, prsh0525 and 4 moreVelanMobileDeveloper
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listplatform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiont: xcode"xcodebuild" on iOS and general Xcode project management"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform teamTriaged by iOS platform team