getsentry / getsentry/sentry-dart

Windows crashpad build support for older toolchains

Open
#2,479 19 comments 2 reactions 0 assignees View on GitHub
Breaking-change Dart Errors Feature
Dominant language
Dart
Stars
873
Forks
299
Avg merge
2d 7h
Merged PRs (30d)
30

Description

### Platform

Flutter Desktop Windows

### Obfuscation

Disabled

### Debug Info

Disabled

### Doctor

```
[√] Flutter (Channel stable, 3.24.5, on Microsoft Windows [Version 10.0.22631.4602], locale en-US)
• Flutter version 3.24.5 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision dec2ee5c1f (4 weeks ago), 2024-11-13 11:13:06 -0800
• Engine revision a18df97ca5
• Dart version 3.5.4
• DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\filip\AppData\Local\Android\sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.7.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
• Visual Studio Build Tools 2022 version 17.7.34024.191
• Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.3)
• Android Studio at C:\Program Files\Android\Android Studio
• 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-b2043.56-10027231)

[√] VS Code (version 1.95.3)
• VS Code at C:\Users\filip\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.102.0

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4602]
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.69
• Edge (web) • edge • web-javascript • Microsoft Edge 128.0.2739.42

[√] Network resources
• All expected network resources are available.

• No issues found!
```

### Version

8.11.0

### Steps to Reproduce

1. Run `flutter build windows`

(I assume there is probably some confounding factor but I'd rather file an incomplete bug than just abandon the filing altogether.)

### Expected Result

App builds.

### Actual Result

After upgrading from `sentry` 8.9.0 to version 8.11.0, my windows build fails with the following cryptic error:

```
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: The command "setlocal [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :cmEnd [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :cmErrorLevel [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: exit /b %1 [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :cmDone [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :VCEnd" exited with code 1. [D:\dev\giant_robot\build\windows\x64\INSTALL.vcxproj]
Building Windows application... 168.6s
Build process failed.
```

After some digging, I realize the real error is hidden by the `INSTALL.vcxproj` machinery. Running the command in question (`"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake`) on the command line produces the following output:

```
-- Install configuration: "Release"
CMake Error at _deps/sentry-native-build/crashpad_build/handler/cmake_install.cmake:41 (file):
file cannot create directory:
D:/dev/giant_robot/build/windows/x64/$/bin.
Maybe need administrative privileges.
Call Stack (most recent call first):
_deps/sentry-native-build/crashpad_build/cmake_install.cmake:46 (include)
_deps/sentry-native-build/cmake_install.cmake:42 (include)
plugins/sentry_flutter/cmake_install.cmake:37 (include)
cmake_install.cmake:57 (include)
```

The error seems to be coming from `_deps/sentry-native-build/crashpad_build/cmake_install.cmake`. Line 41 of that file says:

```cmake
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "D:/dev/giant_robot/build/windows/x64/_deps/sentry-native-build/crashpad_build/handler/Release/crashpad_handler.exe")
```

### Are you willing to submit a PR?

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.