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

IOS Build failed in Xcode 16 #4095

Open
Bayramito opened this issue Sep 17, 2024 · 37 comments
Open

IOS Build failed in Xcode 16 #4095

Bayramito opened this issue Sep 17, 2024 · 37 comments

Comments

@Bayramito
Copy link

Bayramito commented Sep 17, 2024

❗ Update from the maintainers: For building with Xcode 16 you need to

  • Use @sentry/react-native version 5.31.0 or newer.
  • Set APPLICATION_EXTENSION_API_ONLY=YES for Sentry like so:
post_install do |installer|
  react_native_post_install(
    installer,
    config[:reactNativePath],
    :mac_catalyst_enabled => false,
  )

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == 'Sentry'
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
      else
        # configuration for other targets
      end
    end
  end
end

We're investigating how we can make the second step unnecessary (related: #3908).


Description

I just updated my mac to MACOS 15. And also updated Sentry version to latest which is 5.32 but i started to get this build error in Xcode.

Previously i was using xcode 15 and macOS Sonoma and 5.19 of Sentry.

Image

My setup
"@sentry/react-native": "^5.32.0",
"react-native": "0.72.14",
XCode: Version 16.0 (16A242d)

@tommynordli
Copy link

I'm also getting build errors on the latest Xcode

CompileC /Users/tommy/Library/Developer/Xcode/DerivedData/MyApp-bswewohvzvjjatfonkbgcibsndjn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Sentry.build/Objects-normal/arm64/SentryCrashMonitor_CPPException.o /Users/tommy/Git/myApp/app.worktrees/fix-bg-location/ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Sentry' from project 'Pods')
    cd /Users/tommy/Git/myApp/app.worktrees/fix-bg-location/ios/Pods
    
    Using response file: /Users/tommy/Library/Developer/Xcode/DerivedData/MyApp-bswewohvzvjjatfonkbgcibsndjn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Sentry.build/Objects-normal/arm64/82b82416624d2658e5098eb0a28c15c5-common-args.resp
    
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -ivfsstatcache /Users/tommy/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.0-22A3362-db63dc9361471f152f572502bdbfe70a.sdkstatcache -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fno-color-diagnostics -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/tommy/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 -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -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 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/tommy/Library/Developer/Xcode/DerivedData/MyApp-bswewohvzvjjatfonkbgcibsndjn/Index.noindex/DataStore @/Users/tommy/Library/Developer/Xcode/DerivedData/MyApp-bswewohvzvjjatfonkbgcibsndjn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Sentry.build/Objects-normal/arm64/82b82416624d2658e5098eb0a28c15c5-common-args.resp -include /Users/tommy/Git/myApp/app.worktrees/fix-bg-location/ios/Pods/Target\ Support\ Files/Sentry/Sentry-prefix.pch -MMD -MT dependencies -MF /Users/tommy/Library/Developer/Xcode/DerivedData/MyApp-bswewohvzvjjatfonkbgcibsndjn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Sentry.build/Objects-normal/arm64/SentryCrashMonitor_CPPException.d --serialize-diagnostics /Users/tommy/Library/Developer/Xcode/DerivedData/MyApp-bswewohvzvjjatfonkbgcibsndjn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Sentry.build/Objects-normal/arm64/SentryCrashMonitor_CPPException.dia -c /Users/tommy/Git/myApp/app.worktrees/fix-bg-location/ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp -o /Users/tommy/Library/Developer/Xcode/DerivedData/MyApp-bswewohvzvjjatfonkbgcibsndjn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Sentry.build/Objects-normal/arm64/SentryCrashMonitor_CPPException.o -index-unit-output-path /Pods.build/Debug-iphonesimulator/Sentry.build/Objects-normal/arm64/SentryCrashMonitor_CPPException.o
/Users/tommy/Git/myApp/app.worktrees/fix-bg-location/ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:60:13: error: no type named 'terminate_handler' in namespace 'std'
   60 | static std::terminate_handler g_originalTerminateHandler;
      |        ~~~~~^
/Users/tommy/Git/myApp/app.worktrees/fix-bg-location/ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:206:47: error: no member named 'set_terminate' in namespace 'std'
  206 |             g_originalTerminateHandler = std::set_terminate(CPPExceptionTerminate);
      |                                          ~~~~~^
/Users/tommy/Git/myApp/app.worktrees/fix-bg-location/ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:208:18: error: no type named 'set_terminate' in namespace 'std'
  208 |             std::set_terminate(g_originalTerminateHandler);
      |             ~~~~~^
3 errors generated.

Image

@LeandroTamola
Copy link

Same here using expo and development client.

@tommynordli
Copy link

Fixed it by updating react-native to 0.75 (React Native 0.75 is now available with Expo SDK 51) and sentry to 5.32

@Bayramito
Copy link
Author

Fixed it by updating react-native to 0.75 (React Native 0.75 is now available with Expo SDK 51) and sentry to 5.32

Thanks but that's not a solution :) Especially if your project scale is a bit bigger than regular

@teekirol
Copy link

I was able to resolve this by upgrading to @sentry/react-native 5.32.0. I am still using React Native 0.73 and Expo 50.

@montasaurus
Copy link

Make sure you explicitly specify the version, npm is currently showing an older version as the latest

npm i @sentry/[email protected]

Image

@haileyok
Copy link

Upgrading to 5.32.0 does indeed allow us to build the app, however we're seeing a crash in production builds:

-[__NSArrayM length]: unrecognized selector sent to instance 0x303720720

This is coming from https://github.com/getsentry/sentry-react-native/blob/main/ios/RNSentry.mm#L455, where sometimes captureEnvelope is being called with an array rather than a string. Adding a small hack here (bluesky-social/social-app#5400) prevents the crash, though I haven't been able to spend any time to investigate where it is being called with an array rather than string. (It looks like the old behavior - which changed in f15994e - did call it with an array).

I'll open a separate issue with this as well once I verify this isn't a bizarre cache issue.

@darix795
Copy link

darix795 commented Sep 18, 2024

I upgrade to versions 5.24.0, 5.24.3 and 5.32 with react native 0.74.5 but the problem wasn't fixed.
Same issue in sentry-cocoa repo getsentry/sentry-cocoa#4339

Use of undeclared identifier 'SentryLog'

@Bayramito
Copy link
Author

Bayramito commented Sep 18, 2024

I upgrade to versions 5.24.0, 5.24.3 and 5.32 with react native 0.74.5 but the problem wasn't fixed. Same issue in sentry-cocoa repo getsentry/sentry-cocoa#4339

Use of undeclared identifier 'SentryLog'

Only upgrading did not fixed on me either, you also need to apply this in your Podfile.

if target.name != "Sentry"           
   config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' 
end

@darix795
Copy link

darix795 commented Sep 18, 2024

I upgrade to versions 5.24.0, 5.24.3 and 5.32 with react native 0.74.5 but the problem wasn't fixed. Same issue in sentry-cocoa repo getsentry/sentry-cocoa#4339
Use of undeclared identifier 'SentryLog'

Only upgrading did not fixed on me either, you also need to apply this in your Podfile.

if target.name != "Sentry"           
   config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' 
end

Thanks! It seems to work only with version 5.32.0.

Is this a bug or an expected behaviour?
I hope this will be integrate in future versions.

@jrodriguer
Copy link

jrodriguer commented Sep 18, 2024

I upgrade to versions 5.24.0, 5.24.3 and 5.32 with react native 0.74.5 but the problem wasn't fixed. Same issue in sentry-cocoa repo getsentry/sentry-cocoa#4339
Use of undeclared identifier 'SentryLog'

Only upgrading did not fixed on me either, you also need to apply this in your Podfile.

if target.name != "Sentry"           
   config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' 
end

Same error for 'Sentry' installed package.

Image

I updated with recommended settings (Xcode warnings) and add condition to disable APPLICATION_EXTENSION_API_ONLY for non-Sentry targets.

platform :ios, '16'

target '' do
  use_frameworks!

  pod 'Sentry'

end

post_install do |installer|
  installer.aggregate_targets.each do |target|
      target.xcconfigs.each do |variant, xcconfig|
        xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
        IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
      end
    end
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
          xcconfig_path = config.base_configuration_reference.real_path
          IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
        end
        if target.name != "Sentry"
          config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
        end
      end
    end
end

Any recommendations?

@kahest kahest changed the title IOS Build failed in XCode 16 IOS Build failed in Xcode 16 Sep 18, 2024
@jrodriguer
Copy link

I upgrade to versions 5.24.0, 5.24.3 and 5.32 with react native 0.74.5 but the problem wasn't fixed. Same issue in sentry-cocoa repo getsentry/sentry-cocoa#4339
Use of undeclared identifier 'SentryLog'

Only upgrading did not fixed on me either, you also need to apply this in your Podfile.

if target.name != "Sentry"           
   config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' 
end

Same error for 'Sentry' installed package.

Image

I updated with recommended settings (Xcode warnings) and add condition to disable APPLICATION_EXTENSION_API_ONLY for non-Sentry targets.

platform :ios, '16'

target '' do
  use_frameworks!

  pod 'Sentry'

end

post_install do |installer|
  installer.aggregate_targets.each do |target|
      target.xcconfigs.each do |variant, xcconfig|
        xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
        IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
      end
    end
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
          xcconfig_path = config.base_configuration_reference.real_path
          IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
        end
        if target.name != "Sentry"
          config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
        end
      end
    end
end

Any recommendations?

I think it would be more correct to pass this question to the appropriate repository, sentry-cocoa 😳

@kahest
Copy link
Member

kahest commented Sep 18, 2024

@jrodriguer which version of the SDK are you using? For building with Xcode 16 you need to update to 5.31.0 or newer.

@kahest
Copy link
Member

kahest commented Sep 18, 2024

❗ Please note: For building with Xcode 16 you need to

  • Use @sentry/react-native version 5.31.0 or newer.
  • Set APPLICATION_EXTENSION_API_ONLY=YES for Sentry like so:
    target.build_configurations.each do |config|
      if target.name != "Sentry"
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end

We're investigating how we can make the second step unnecessary (related: #3908).

@jrodriguer
Copy link

@jrodriguer which version of the SDK are you using? For building with Xcode 16 you need to update to 5.31.0 or newer.

❗ Please note: For building with Xcode 16 you need to

  • Use @sentry/react-native version 5.31.0 or newer.
  • Set APPLICATION_EXTENSION_API_ONLY=YES for Sentry like so:
    target.build_configurations.each do |config|
      if target.name != "Sentry"
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end

We're investigating how we can make the second step unnecessary (related: #3908).

I don't have react-native, if not an IOS project with Pod as a dependency manager.
The second step working fine.

I have updated Sentry to the latest version, now everything is correct.

@osbornZ
Copy link

osbornZ commented Sep 20, 2024

No type named 'terminate_handler' in
namespace 'std'
& No member named 'set_terminate' in
namespace 'std'
x No type named'set_terminate' in
namespace 'std'

I got error when my xcode update to 16.0,and when i use

"@sentry/react-native": "^5.31.0",
and set
if target.name != "Sentry"
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end

rebuild there toast system crash:

Process:               XCBBuildService [5771]
Path:                  /Applications/Xcode.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService

@kailashAppDev
Copy link

I'm getting this error with expo ^51.0.18, react native 0.74.3 and sentry ~5.32.0

/ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Sentry' from project 'Pods')

@tmcjunkinmarquis
Copy link

I am getting this error with the latest Xcode and
"expo": "^49.0.0",
"react-native": "0.72.6",
"@sentry/react-native": "5.32.0"
and made the changes recommend by @kahest .
Thank you for working on it.

@peyman-se
Copy link

This combination for expo worked for us:

Expo: 51.0.31
sentry/react-native: 5.24.3

@iamthemuhammadirfan
Copy link

iamthemuhammadirfan commented Sep 23, 2024

Will the upgradation of package corrupt the implementation as well?
Mine react native version is 0.72.4
and my package version is 5.32
Even after I'm getting this error

Image
Image

@JoaoPauloCMarra
Copy link

Image
same here preventing EAS builds

@bytemtek
Copy link

bytemtek commented Sep 24, 2024

This versions work without problem.

"@sentry/react-native": "5.33.0",
"expo": "^51.0.32",
"react-native": "0.74.5"

@kahest
Copy link
Member

kahest commented Sep 25, 2024

@JoaoPauloCMarra the warning comes from Expo recommending a specific version of @sentry/react-native - we have multiple reports that it works fine with 5.24.3 and 5.33.1, so this should not prevent you building and testing the app

@tmcjunkinmarquis
Copy link

@kahest , yes, I made the change to the Podfile also.

@fbeccaceci
Copy link

@JoaoPauloCMarra the warning comes from Expo recommending a specific version of @sentry/react-native - we have multiple reports that it works fine with 5.24.3 and 5.33.1, so this should not prevent you building and testing the app

It builds with 5.33.1 but the sourcemaps are not uploaded automatically so all errors show up unsymolicated

@kahest
Copy link
Member

kahest commented Sep 26, 2024

@fbeccaceci do you use RN 0.75.x? There is a separate issue tracking a potential problem with that version here: #4120

@fbeccaceci
Copy link

@kahest no, still on 0.74.3 which is the default with expo sdk 51

@kahest
Copy link
Member

kahest commented Sep 27, 2024

Quick update - we're working on getting Expo's dependency updated. We're also investigating some reports of source maps not being uploaded correctly with Xcode 16, but weren't able to reproduce this. If you have more info - ideally a repro - please let us know

@JoaoPauloCMarra
Copy link

Quick update - we're working on getting Expo's dependency updated. We're also investigating some reports of source maps not being uploaded correctly with Xcode 16, but weren't able to reproduce this. If you have more info - ideally a repro - please let us know

created this PR related to the version update

@shehryar-munir
Copy link

shehryar-munir commented Sep 28, 2024

Xcode 16, React Native version 0.64, "@sentry/react-native": "^5.31.0",
Facing this isuse when trying to build IOS app from xcode

Undefined symbols for architecture x86_64:
  "_swift_willThrowTypedImpl", referenced from:
      _swift_willThrowTyped in libSentry.a[272](SentryOnDemandReplay.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@maimai886
Copy link

maimai886 commented Sep 30, 2024

In my case, I’m using an older version of RN and Sentry, and the following error occurred.
"react-native": "0.61.2"
No type named 'terminate_handler' in namespace 'std'
No member named 'set_terminate' in namespace 'std'
No type named 'set_terminate' in namespace 'std'

After adding this code at the bottom of the Podfile, it can run successfully.


 post_install do |installer|
          installer.pods_project.targets.each do |target|
            if target.name == 'Sentry'
        
              file_path = 'Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp'
              contents = File.read(file_path)
              unless contents.include?('#include <exception>')
                FileUtils.chmod('u+w', file_path)
                File.open(file_path, 'w') do |file|
                  file.puts('#include <exception>')
                  file.puts(contents)
                end
              end
              file_path = 'Pods/Sentry/Sources/SentryCrash/Recording/Tools/SentryCrashMachineContext.c'
              contents = File.read(file_path)
              unless contents.include?('#include <sys/_types/_ucontext64.h>')
                FileUtils.chmod('u+w', file_path)
                File.open(file_path, 'w') do |file|
                  file.puts('#include <sys/_types/_ucontext64.h>')
                  file.puts(contents)
                end
              end
        
            end
          end
        end

@carlosriveroib
Copy link

I'm getting this error with expo ^51.0.18, react native 0.74.3 and sentry ~5.32.0

/ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Sentry' from project 'Pods')

same here

@krystofwoldrich
Copy link
Member

@maimai886 Thank you for posting the workaround for RN 0.61.2 and Xcode 16. Is there anything else we can do for you? If so please open a new issue where we can track it.

Currently RN 0.65 and older are unsupported by both the Sentry RN SDK and byt the React Native team.

@krystofwoldrich
Copy link
Member

@shehryar-munir Thank you for reporting the issue with RN 0.64, Xcode 16 and @sentry/[email protected]. Sadly RN 0.64 is unsupported by the SDK and also by the RN team.

What Sentry RN SDK version were you using before upgrading to Xcode 16?

@wdifruscio
Copy link

This is so frustrating.. since the new xcode was released i think I am going to have to spend who knows how long figuring out how to rebuild this app to work on the latest RN version

Anyway, I started having this issue on 0.69.6 and 4.2.2

I wasn't having it yesterday but I ran a new prebuild in an attempt to fix some other deps and now this is causing me pain again, hopefully I can upgrade to a minor version bump to resolve

I also noticed on the older version that there was a bitcode error when uploading to app store with xcode16 and 4.2.2 - if relevant for whoever reads this lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Status: Needs Discussion
Development

No branches or pull requests