getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
745 stars 231 forks source link

Missing '#include <sys/_types/_ucontext64.h>'; 'ucontext64_t' must be declared before it is used #2222

Closed Jethro87 closed 1 month ago

Jethro87 commented 1 month ago

Platform

Dart

Obfuscation

Enabled

Debug Info

Enabled

Doctor

[!] Flutter (Channel stable, 3.24.0, on macOS 14.5 23F79 darwin-arm64, locale en-CA)
    • Flutter version 3.24.0 on channel stable at /Users/jeffreybunn/.puro/envs/stable/flutter
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.3.4/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
      /Users/jeffreybunn/.puro/envs/stable/flutter. Consider adding /Users/jeffreybunn/.puro/envs/stable/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (9 days ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2
    • 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/jeffreybunn/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/jeffreybunn/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • 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.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.91.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.94.0

[✓] Connected device (5 available)
    • Jeffrey’s iPhone 15 Pro (mobile) • 00008130-000639293A31001C • ios            • iOS 18.1 22B5007p
    • Maria’s iPhone (mobile)          • 00008110-0018093A2686401E • ios            • iOS 18.0 22A5326f
    • macOS (desktop)                  • macos                     • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop)  • mac-designed-for-ipad     • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                     • chrome                    • web-javascript • Google Chrome 127.0.6533.100
    ! Error: Browsing on the local area network for Jeffrey’s iPhone 15. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

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

Version

8.6.0

Steps to Reproduce

Try to build using iOS 18 and XCode 16 beta 5 and I get this error:

Missing '#include <sys/_types/_ucontext64.h>'; 'ucontext64_t' must be declared before it is used

in SentryCrashMachineContext:

#include "SentryCrashMachineContext.h"
#include "SentryCrashCPU.h"
#include "SentryCrashCPU_Apple.h"
#include "SentryCrashMachineContext_Apple.h"
#include "SentryCrashMonitor_MachException.h"
#include "SentryCrashStackCursor_MachineContext.h"
#include "SentryInternalCDefines.h"

#include <mach/mach.h>

#include "SentryAsyncSafeLog.h"

#ifdef __arm64__
#    define UC_MCONTEXT uc_mcontext64
typedef ucontext64_t SignalUserContext;
#else
#    define UC_MCONTEXT uc_mcontext
typedef ucontext_t SignalUserContext;
#endif

Missing declaration leads to here:

#ifndef _STRUCT_UCONTEXT64

#include <sys/cdefs.h> /* __DARWIN_UNIX03 */

#if __DARWIN_UNIX03
#define _STRUCT_UCONTEXT64      struct __darwin_ucontext64
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_UCONTEXT64      struct ucontext64
#endif /* __DARWIN_UNIX03 */

#include <machine/types.h> /* __darwin_size_t */
#include <machine/_mcontext.h> /* _STRUCT_MCONTEXT */
#include <sys/_types.h> /* __darwin_sigset_t */
#include <sys/_types/_sigaltstack.h> /* _STRUCT_SIGALTSTACK */

_STRUCT_UCONTEXT64
{
    int                     uc_onstack;
    __darwin_sigset_t       uc_sigmask;     /* signal mask used by this context */
    _STRUCT_SIGALTSTACK     uc_stack;       /* stack used by this context */
    _STRUCT_UCONTEXT64      *uc_link;       /* pointer to resuming context */
    __darwin_size_t         uc_mcsize;      /* size of the machine context passed in */
    _STRUCT_MCONTEXT64      *uc_mcontext64; /* pointer to machine specific context */
};
typedef _STRUCT_UCONTEXT64      ucontext64_t;   /* [???] user context */

#endif /* _STRUCT_UCONTEXT64 */

Expected Result

Am able to build

Actual Result

Cannot build

Are you willing to submit a PR?

No

buenaflor commented 1 month ago

it's fixed in the cocoa sdk https://github.com/getsentry/sentry-cocoa/pull/4244

please wait for the next sentry dart release, it will include the new cocoa version