Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error with Bugsnag package #1101

Open
jeffhodsdon opened this issue Jun 6, 2024 · 3 comments
Open

Compile error with Bugsnag package #1101

jeffhodsdon opened this issue Jun 6, 2024 · 3 comments

Comments

@jeffhodsdon
Copy link

Hello! Thanks again for all this work on this project. It has been very helpful. I am running into a cpp/objc compile issue with the Bugsnag library. I'm not sure how to explain and therefore pasting the build output here for any advice. KSCrash is relatively popular so I wanted to flag.

https://github.com/bugsnag/bugsnag-cocoa


ERROR: /private/var/tmp/_bazel_j/d38be8983e87d8b7fd2770bb2d2d3c53/rules_xcodeproj.noindex/build_output_base/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/BUILD.bazel:56:13: Compiling Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSLogger.c failed: (Exit 1): wrapped_clang failed: error executing CppCompile command (from target @@rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa//:Bugsnag.rspm)

  (cd /private/var/tmp/_bazel_j/d38be8983e87d8b7fd2770bb2d2d3c53/rules_xcodeproj.noindex/build_output_base/execroot/_main && \

  exec env - \

    APPLE_SDK_PLATFORM=iPhoneSimulator \

    APPLE_SDK_VERSION_OVERRIDE=17.5 \

    PATH=/bin:/usr/bin \

    XCODE_VERSION_OVERRIDE=15.4.0.15F31d \

    ZERO_AR_DATE=1 \

  external/apple_support~~apple_cc_configure_extension~local_config_apple_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -g '-fdebug-prefix-map=__BAZEL_EXECUTION_ROOT__=.' '-fdebug-prefix-map=__BAZEL_XCODE_DEVELOPER_DIR__=/PLACEHOLDER_DEVELOPER_DIR' -iquote external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa -iquote bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/include -Ibazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/include -MD -MF bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/_objs/Bugsnag.rspm/arc/BSG_KSLogger.d '-DSWIFT_PACKAGE=1' '-frandom-seed=bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/_objs/Bugsnag.rspm/arc/BSG_KSLogger.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -fobjc-arc -no-canonical-prefixes -pthread -fblocks -fobjc-arc -fPIC '-fmodule-name=Bugsnag' -includebazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag.rspm_objc_resource_bundle_accessor_hdr_ObjcResourceBundleAccessor.h -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Breadcrumbs -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Client -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Configuration -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Delivery -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Helpers -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/include/Bugsnag -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/KSCrash -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/KSCrash/Source/KSCrash/Recording -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/KSCrash/Source/KSCrash/Recording/Sentry -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/KSCrash/Source/KSCrash/Recording/Tools -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/KSCrash/Source/KSCrash/Reporting/Filters -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Metadata -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Payload -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Plugins -Iexternal/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/Storage -fmodules '-fmodules-cache-path=bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/_objc_module_cache' -O0 '-DDEBUG=1' -fstack-protector -fstack-protector-all -g -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -target arm64-apple-ios17.0-simulator -c external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag/KSCrash/Source/KSCrash/Recording/Tools/BSG_KSLogger.c -o bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/_objs/Bugsnag.rspm/arc/BSG_KSLogger.o)

# Configuration: b0ce053fefe2ffff3d3969ef856a300d3a36b312f3cb63c89887ae2777c8a241

# Execution platform: @@local_config_platform//:host

While building module 'Foundation' imported from ./bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag.rspm_objc_resource_bundle_accessor_hdr_ObjcResourceBundleAccessor.h:1:

In file included from <module-includes>:1:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:9:

@class NSString, Protocol;

^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:601:1: Expected identifier or '('

typedef NSString * NSExceptionName NS_TYPED_EXTENSIBLE_ENUM;

        ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:603:9: Unknown type name 'NSString'

typedef NSString * NSRunLoopMode NS_TYPED_EXTENSIBLE_ENUM;

        ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:604:9: Unknown type name 'NSString'

FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector);

                  ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:606:19: Unknown type name 'NSString'

FOUNDATION_EXPORT SEL NSSelectorFromString(NSString *aSelectorName);

                                           ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:607:44: Unknown type name 'NSString'

FOUNDATION_EXPORT NSString *NSStringFromClass(Class aClass);

                  ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:609:19: Unknown type name 'NSString'

FOUNDATION_EXPORT Class _Nullable NSClassFromString(NSString *aClassName);

                                                    ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:610:53: Unknown type name 'NSString'

FOUNDATION_EXPORT NSString *NSStringFromProtocol(Protocol *proto) API_AVAILABLE(macos(10.5), ios(2.0), watchos(2.0), tvos(9.0));

                  ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:612:19: Unknown type name 'NSString'

FOUNDATION_EXPORT NSString *NSStringFromProtocol(Protocol *proto) API_AVAILABLE(macos(10.5), ios(2.0), watchos(2.0), tvos(9.0));

                                                 ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:612:50: Missing '#include <objc/runtime.h>'; 'Protocol' must be declared before it is used

typedef struct objc_object Protocol;

                           ^

While building module 'Foundation' imported from ./bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag.rspm_objc_resource_bundle_accessor_hdr_ObjcResourceBundleAccessor.h:1:

In file included from <module-includes>:1:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:9:

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/usr/include/objc/runtime.h:60:28: declaration here is not visible

FOUNDATION_EXPORT Protocol * _Nullable NSProtocolFromString(NSString *namestr) API_AVAILABLE(macos(10.5), ios(2.0), watchos(2.0), tvos(9.0));

                                                            ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:613:61: Unknown type name 'NSString'

FOUNDATION_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2) NS_NO_TAIL_CALL;

                             ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:617:30: Unknown type name 'NSString'

FOUNDATION_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2) NS_NO_TAIL_CALL;

                             ~~~~~~~~~~~~~~~~       ^                  ~

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:617:53: Format argument not a string type

        #define NS_FORMAT_FUNCTION(F,A) __attribute__((format(__NSString__, F, A)))

                                                       ^                    ~

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:94:49: expanded from macro 'NS_FORMAT_FUNCTION'

FOUNDATION_EXPORT void NSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0) NS_NO_TAIL_CALL;

                              ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:618:31: Unknown type name 'NSString'

FOUNDATION_EXPORT void NSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0) NS_NO_TAIL_CALL;

                              ~~~~~~~~~~~~~~~~                ^                  ~

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:618:63: Format argument not a string type

        #define NS_FORMAT_FUNCTION(F,A) __attribute__((format(__NSString__, F, A)))

                                                       ^                    ~

While building module 'Foundation' imported from ./bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag.rspm_objc_resource_bundle_accessor_hdr_ObjcResourceBundleAccessor.h:1:

In file included from <module-includes>:1:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:9:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:9:

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:94:49: expanded from macro 'NS_FORMAT_FUNCTION'

  module NSObject {

         ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/usr/include/objc/module.modulemap:8:10: Module 'ObjectiveC.NSObject' requires feature 'objc'

#import <objc/NSObject.h>

        ^

While building module 'Foundation' imported from ./bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag.rspm_objc_resource_bundle_accessor_hdr_ObjcResourceBundleAccessor.h:1:

In file included from <module-includes>:1:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:11:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:7:

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:5:9: submodule of top-level module 'ObjectiveC' implicitly imported here

@class NSString;

^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:9:1: Expected identifier or '('

FOUNDATION_EXPORT void NSSetZoneName(NSZone * _Nullable zone, NSString *name)NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");

                                                              ^

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:19:63: Unknown type name 'NSString'

FOUNDATION_EXPORT NSString *NSZoneName(NSZone * _Nullable zone) NS_SWIFT_UNAVAILABLE("Zone-based memory management is unavailable");

                  ^

While building module 'Foundation' imported from ./bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag.rspm_objc_resource_bundle_accessor_hdr_ObjcResourceBundleAccessor.h:1:

In file included from <module-includes>:1:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:11:

In file included from /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:20:19: Unknown type name 'NSString'

@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;

^

fatal error: too many errors emitted, stopping now [-ferror-limit=]

In file included from <built-in>:1:

./bazel-out/ios_sim_arm64-dbg-ios-sim_arm64-min17.0-applebin_ios-ST-1d00ae144680/bin/external/rules_swift_package_manager~~swift_deps~swiftpkg_bugsnag_cocoa/Bugsnag.rspm_objc_resource_bundle_accessor_hdr_ObjcResourceBundleAccessor.h:1:9: fatal error: could not build module 'Foundation'

#import <Foundation/Foundation.h>

 ~~~~~~~^

21 errors generated.

Error in child process '/usr/bin/xcrun'. 1

INFO: Elapsed time: 0.273s, Critical Path: 0.11s

INFO: 20 processes: 17 internal, 2 local, 1 worker.

ERROR: Build did NOT complete successfully

/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:9:1: Expected identifier or '('


@cgrindel
Copy link
Owner

cgrindel commented Jun 8, 2024

Without a repro, it will be difficult to nail this down. If you could provide one, that would be very helpful.

One thing that I did notice is that bugsnag-cocoa specifies c and c++ language standards. The output of running bazel run //:swift_update_pkgs should have suggested some entries to add to your .bazelrc. Did you add them?

@jeffhodsdon
Copy link
Author

Output of the //:swift_update_pkgs did return suggested entries. However, I still get the same error during the build.

INFO: Analyzed target //ios:swift_update_pkgs (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //ios:swift_update_pkgs up-to-date:
  bazel-bin/ios/swift_update_pkgs-runner.bash
  bazel-bin/ios/swift_update_pkgs
INFO: Elapsed time: 0.113s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/ios/swift_update_pkgs
One or more of your Swift packages has defined language standard requirements.
Consider adding the following to your .bazelrc file:

# Required by bugsnag-cocoa
build --copt='-std=gnu11'
# Required by bugsnag-cocoa
build --cxxopt='-std=gnu++14'
# Required by sentry-cocoa, swift-nio-ssl
build --cxxopt='-std=c++14'

@cgrindel
Copy link
Owner

Unfortunately, without a repro, it will be difficult for me to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants