bugsnag / bugsnag-cocoa

BugSnag error monitoring & exception reporter for iOS, macOS, tvOS and watchOS
https://docs.bugsnag.com/platforms/ios
MIT License
235 stars 129 forks source link

We're struggling to build the iOS framework under Cocoapods with Xcode 16 beta 6. #1692

Closed marcpalmer closed 3 days ago

marcpalmer commented 2 weeks ago

Describe the bug

Building Bugsnag 6.30.1 in Xcode 16 beta 6 results in some compiler errors.

Steps to reproduce

  1. Open an iOS project that uses 6.30.1 in Xcode 16 beta 6
  2. Build it
  3. See build errors in the build activity pane.

Environment

Build errors: ``` CompileC /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Objects-normal/arm64/BugsnagSystemState.o /Users/marc/Projects/checkout/concepts/Pods/Bugsnag/Bugsnag/BugsnagSystemState.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'Bugsnag' from project 'Pods') cd /Users/marc/Projects/checkout/concepts/Pods /Users/marc/Projects/checkout/concepts/Pods/../Scripts/Xcode/cc.sh -x objective-c -target arm64-apple-ios15.0 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fno-color-diagnostics -std\=gnu11 -fobjc-arc -fobjc-weak -fmodules -gmodules -fmodules-cache-path\=/Users/marc/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/marc/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -fmodule-name\=Bugsnag -fapplication-extension -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-implicit-fallthrough -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -DBSG_LOG_LEVEL\=BSG_LOGLEVEL_NONE -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode-16.0.0-Beta.6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Index.noindex/DataStore -iquote /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Bugsnag-generated-files.hmap -I/Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Bugsnag-own-target-headers.hmap -I/Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Bugsnag-all-non-framework-target-headers.hmap -ivfsoverlay /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Pods-8699adb1dd336b26511df848a716bd42-VFS-iphoneos/all-product-headers.yaml -iquote /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Bugsnag-project-headers.hmap -I/Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Products/Debug-iphoneos/Bugsnag/include -I/Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/DerivedSources-normal/arm64 -I/Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/DerivedSources/arm64 -I/Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/DerivedSources -F/Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Products/Debug-iphoneos/Bugsnag -fvisibility\=hidden -MMD -MT dependencies -MF /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Objects-normal/arm64/BugsnagSystemState.d --serialize-diagnostics /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Objects-normal/arm64/BugsnagSystemState.dia -c /Users/marc/Projects/checkout/concepts/Pods/Bugsnag/Bugsnag/BugsnagSystemState.m -o /Users/marc/Library/Developer/Xcode/DerivedData/Concepts-fmsmwdpevpqbptbengnxlsyfcbhz/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/Bugsnag.build/Objects-normal/arm64/BugsnagSystemState.o /Users/marc/Projects/checkout/concepts/Pods/Bugsnag/Bugsnag/BugsnagSystemState.m:167:14: error: call to undeclared function 'atomic_compare_exchange_strong'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] if (!atomic_compare_exchange_strong(&writePending, &expected, YES)) { ^ /Users/marc/Projects/checkout/concepts/Pods/Bugsnag/Bugsnag/BugsnagSystemState.m:174:9: error: call to undeclared function 'atomic_store'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] atomic_store(&writePending, NO); ^ 2 errors generated. ```
toniewypada commented 1 week ago

Hi @marcpalmer 👋🏻,

I see that you’ve contacted us directly, and the issue was solved.

For visibility, what happened in this case was:

the APIs the compiler complains about are defined in , which is included at the top of the file here: bugsnag-cocoa/Bugsnag/BugsnagSystemState.m at master · bugsnag/bugsnag-cocoa - any failure to find it could be due to a compiler problem or a compiler installation problem.

marcpalmer commented 1 week ago

Thanks @toniewypada adding some colour here if anybody else hits this:

  1. We are using ccache as part of our build tooling to cache C/C++ files and speed up builds
  2. When trying to build under Xcode 16 beta, it would be using our custom cc.sh stub script to run ccache using /usr/bin/clang
  3. When Xcode 16 beta was being used but the CLI toolchain was not set to Xcode 16's toolchain (either in Xcode UI or xcode-select) this would lead to a mismatch in tooling when building with Xcode
  4. The solution for us is to change our cc.sh stub that calls ccache and make it pass in just clang instead of /usr/bin/clang and this uses the correct tooling based on the current PATH which is set to the correct value by Xcode when running builds in Xcode, and uses the xcode-select toolchain when building from CLI.