Skip to content

Commit 7a8e617

Browse files
flutter: update troubleshooting page (#14312)
Updates troubleshooting related to Linux issues for Flutter --------- Co-authored-by: Alex Krawiec <[email protected]>
1 parent 3df9219 commit 7a8e617

File tree

2 files changed

+44
-7
lines changed

2 files changed

+44
-7
lines changed

docs/platforms/dart/guides/flutter/migration.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,7 @@ Native crash handling is now enabled by default for Flutter Desktop.
7272
Windows ARM64 uses [breakpad](https://chromium.googlesource.com/breakpad/breakpad) and all other desktop platforms use [crashpad](https://chromium.googlesource.com/crashpad/crashpad).
7373
You can disable this feature by setting the `SENTRY_NATIVE_BACKEND` environment variable to "none". e.g `export SENTRY_NATIVE_BACKEND=none`
7474

75-
<Alert>
76-
77-
On Linux, compiling your Flutter Desktop app with the crashpad backend can fail if your clang toolchain is out of date.
78-
- Update your clang to the latest version, then try again.
79-
- If you still encounter errors, please file an issue on our [Sentry Dart GitHub repository](https://github.com/getsentry/sentry-dart/issues/).
80-
81-
</Alert>
75+
If you encounter any issues, please refer to the [troubleshooting guide](/platforms/dart/guides/flutter/troubleshooting/#issues-with-native-crashes-on-linux-andor-windows).
8276

8377
### Flutter Web
8478

docs/platforms/dart/guides/flutter/troubleshooting.mdx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,49 @@ By default the Sentry Flutter SDK will enable native crash reporting on Linux an
7171
The only exception is Windows ARM64 which uses `breakpad`.
7272
If you encounter any issues, you can set the `SENTRY_NATIVE_BACKEND` environment variable to an empty string to disable native crash reporting.
7373

74+
### Crashpad Compile Error
75+
76+
On Linux, compiling your Flutter Desktop app with the crashpad backend can fail if your clang toolchain is out of date.
77+
78+
- Update your clang to at least version 13, then try again.
79+
- If you still encounter errors, please file an issue on our [Sentry Dart GitHub repository](https://github.com/getsentry/sentry-dart/issues/).
80+
81+
### `SentryFlutter.init` Throws a `sentry_init failed` Error
82+
83+
On Linux, `SentryFlutter.init` automatically tries to use the crashpad backend.
84+
There are cases where the Flutter tooling overrides the permission of the crashpad binary, causing the initialization to fail.
85+
86+
To resolve this:
87+
88+
1. Search for the following code block in your `linux/CMakeLists.txt` file:
89+
90+
```cmake {filename:<your-app>/linux/CMakeLists.txt}
91+
# Find this code block
92+
if(PLUGIN_BUNDLED_LIBRARIES)
93+
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
94+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
95+
COMPONENT Runtime)
96+
endif()
97+
```
98+
99+
2. Once you find it, replace it with the following code block:
100+
101+
```cmake {filename:<your-app>/linux/CMakeLists.txt}
102+
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
103+
if("${bundled_library}" STREQUAL "$<TARGET_FILE:crashpad_handler>")
104+
install(PROGRAMS "${bundled_library}"
105+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
106+
COMPONENT Runtime)
107+
else()
108+
install(FILES "${bundled_library}"
109+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
110+
COMPONENT Runtime)
111+
endif()
112+
endforeach()
113+
```
114+
115+
This allows cmake to use the correct install command `install(PROGRAMS ..)` instead of `install(FILES ..)` which strips the executable bit.
116+
74117
## Zone Mismatch Error on Web
75118

76119
By default, the Sentry Flutter SDK creates a custom zone on web for automatic error and breadcrumb tracking. This can lead to zone mismatch errors when your application calls `WidgetsBinding.ensureInitialized()` before initializing Sentry.

0 commit comments

Comments
 (0)