flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.38k stars 27.56k forks source link

[iOS] invalid symbols files produced by --split-debug-info #138182

Open btrautmann opened 1 year ago

btrautmann commented 1 year ago

Is there an existing issue for this?

Steps to reproduce

  1. Create a Flutter project using flutter create
  2. Build the flutter application using the following command (note, signing disabled for ease, but this reproduces with signed binaries as well):
    flutter build ipa --no-codesign --split-debug-info=app-symbols -v
  3. Navigate to the app-symbols directory and run the following:
  4. Install the Sentry CLI by following these directions.
  5. Verify the validity of the produced symbols files by running the following:
    sentry-cli debug-files check app.ios-arm64.symbols

Expected results

Sentry CLI should produce output indicating that the produced debug file is valid:

Debug Info File Check
  Type: elf debug companion
  Contained debug identifiers:
    > Debug ID: cf2c4e5d-9766-3f21-b0cd-b42e5c0e2683
      Code ID:  cf2c4e5d97663f21b0cdb42e5c0e2683
      Arch:     arm64
  Contained debug information:
    > symtab, unwind
  Usable: yes

Actual results

Sentry CLI produces output indicating that the produced debug file is invalid:

Debug Info File Check
  Type: elf debug companion
  Contained debug identifiers:
    > Debug ID: 00000000-0000-0000-0000-000000000000
      Arch:     arm64
  Contained debug information:
    > symtab, debug
  Usable: no (missing debug identifier, likely stripped)

Code sample

I've created a reproduction repo here, though it's basically just a shell project, so nothing too special.

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Ironically my output exceeded the maximum character length. Including as a file.

build_output.txt

Flutter Doctor output

Doctor output ```console [!] Flutter (Channel unknown, 3.10.7, on macOS 13.6.1 22G313 darwin-arm64, locale en-US) ! Flutter version 3.10.7 on channel unknown at /Users/brandontrautmann/fvm/versions/3.10.7 Currently on an unknown channel. Run `flutter channel` to switch to an official channel. If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. ! Unknown upstream repository. Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install. • Framework revision e285328a69 (3 months ago), 2023-08-17 17:55:17 -0700 • Engine revision 077a732ef4 • Dart version 3.0.7 • DevTools version 2.23.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) • Android SDK at /Users/brandontrautmann/Library/Android/sdk • Platform android-33, build-tools 33.0.1 • ANDROID_SDK_ROOT = /Users/brandontrautmann/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode_14.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [✓] IntelliJ IDEA Community Edition (version 2023.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code (version 1.84.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.76.0 [✓] Connected device (4 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • iPhone 13 mini (mobile) • 0492C672-A151-402C-AAA0-0B694038CF37 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.6.1 22G313 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.123 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```

Note: We're currently using the funky 3.10.7 release that (AFAIK) never made it to stable, but I've tried this on versions going way back in time and am having the same issue with all versions.

btrautmann commented 1 year ago

I filed an issue here previously with Sentry but it seems this is not an issue on their end: https://github.com/getsentry/sentry-cli/issues/1786

I do wonder if because sentry-cli does not fail builds for this (it instead fails to upload silently) if this is an issue for others or if --split-debug-info is not widely used...

huycozy commented 1 year ago

Reproduced the issue on the latest Flutter stable/master channels by following the given steps.

flutter doctor -v (stable and master) ```bash [✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-x64, locale en-VN) • Flutter version 3.13.9 on channel stable at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision d211f42860 (11 days ago), 2023-10-25 13:42:25 -0700 • Engine revision 0545f8705d • Dart version 3.1.5 • DevTools version 2.25.0 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Users/huynq/Downloads/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.13.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio Giraffe.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = /Applications/Android Studio.app/ • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.84.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.76.0 [✓] Connected device (4 available) • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30) • iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios • iOS 15.7.9 19H365 • macOS (desktop) • macos • darwin-x64 • macOS 14.1 23B74 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 118.0.5993.117 [✓] Network resources • All expected network resources are available. • No issues found! ``` ```bash [!] Flutter (Channel master, 3.17.0-5.0.pre.37, on macOS 14.1 23B74 darwin-x64, locale en-VN) • Flutter version 3.17.0-5.0.pre.37 on channel master at /Users/huynq/Documents/GitHub/flutter_master ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision fa3a37c76d (29 minutes ago), 2023-11-09 18:15:27 -0800 • Engine revision e80af854bd • Dart version 3.3.0 (build 3.3.0-113.0.dev) • DevTools version 2.30.0-dev.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.13.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio Giraffe.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [!] Android Studio (version unknown) • Android Studio at /Applications/Android Studio Preview.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart ✗ Unable to determine Android Studio version. • Java version OpenJDK Runtime Environment (build 17.0.8+0-17.0.8b1000.22-10799086) [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = /Applications/Android Studio.app/ • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.84.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.76.0 [✓] Connected device (3 available) • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64 • Android 11 (API 30) • macOS (desktop) • macos • darwin-x64 • macOS 14.1 23B74 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.123 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 2 categories. ```
sobimor commented 7 months ago

Any update on this issue?

QuirijnGB commented 4 months ago

Still happens on Flutter 3.22.2

sentry-cli debug-files check debug_symbols/123/ios/app.ios-arm64.symbols
Debug Info File Check
  Type: elf debug companion
  Contained debug identifiers:
    > Debug ID: 00000000-0000-0000-0000-000000000000
      Arch:     arm64
  Contained debug information:
    > symtab, debug
  Usable: no (missing debug identifier, likely stripped)
flutter doctor ``` [✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-NL) • Flutter version 3.22.2 on channel stable at /opt/homebrew/Caskroom/flutter/3.13.9/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (5 weeks ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/quirijngb/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/quirijngb/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 ```
Masrepus commented 1 month ago

Commenting my findings from the duplicated issue I created, in case it helps other people see why this happens: The underlying reason why sentry can't extract that info is that the app.ios-arm64.symbols file doesn't have a .note.gnu.build-id section that the Android symbol files do have. This section is the one that's supposed to contain the UUID of the iOS binary.

It's a bit weird anyway that the Flutter compiler produces an ELF binary for iOS symbols, because iOS binaries actually use the MachO format. The UUID there isn't stored in a .note.gnu.build-id section but rather in the LC_UUID load command.