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

Build fails on Xcode 16.0 Beta #3883

Closed
5 of 11 tasks
Mitch528 opened this issue Jun 11, 2024 · 43 comments
Closed
5 of 11 tasks

Build fails on Xcode 16.0 Beta #3883

Mitch528 opened this issue Jun 11, 2024 · 43 comments

Comments

@Mitch528
Copy link

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 0.0.0

react-native version: 5.23.1

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://[email protected]/...'
  // other options
});

I have the following issue:

Fails to build on Xcode 16.0 Beta (16A5171c)

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;
      |        ~~~~~^
ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:207:47: error: no member named 'set_terminate' in namespace 'std'
  207 |             g_originalTerminateHandler = std::set_terminate(CPPExceptionTerminate);
      |                                          ~~~~~^
ios/Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:209:18: error: no type named 'set_terminate' in namespace 'std'
  209 |             std::set_terminate(g_originalTerminateHandler);
      |             ~~~~~^

Steps to reproduce:

  • Install Sentry package
  • Install pods
  • Build

Actual result:

Build fails

Expected result:

Build does not fail

@kahest
Copy link
Member

kahest commented Jun 11, 2024

Hey @Mitch528 thanks for writing in - this was already fixed in the sentry-cocoa SDK. Please note that it will take a few days to get that released on sentry-cocoa and then dependency bumped and released here as well.

@krystofwoldrich
Copy link
Member

Fix was released in https://github.com/getsentry/sentry-cocoa/releases/tag/8.29.0
Let's use this version in the RN SDK.

@EugeniuszX
Copy link

@kahest Counting on you!

@3DTOPO
Copy link

3DTOPO commented Jun 14, 2024

I ran pod update and now get a different error with Xcode 16 beta 1:

@_implementationOnly import _SentryPrivate
No such module '_SentryPrivate

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jun 14, 2024
@hannojg
Copy link

hannojg commented Jun 16, 2024

I used the new version 8.29.0, and now getting these errors

Screenshot 2024-06-16 at 13 43 15

// Edit: I probably was just a bit too fast and the latest native sentry pod isn't compatible with rn-sentry yet 😅

@PraneethGunas
Copy link

Can we have a temporary workaround until the fix is released?

@TrustDec
Copy link

Hi, is there any update progress? Or a temporary solution?

@krystofwoldrich
Copy link
Member

Hello everyone, we will release 5.24.0 later today which will be compatible with Xcode 16.

@venables
Copy link

venables commented Jun 17, 2024

Just a quick heads up that 5.24.0 does not include the fix for this issue, but the main branch does include it from #3890

@yolpsoftware
Copy link

yolpsoftware commented Sep 19, 2024

@aprilmintacpineda same here. My EAS builds did not work anymore, because my Expo project references Sentry 5.20.0.

I didn't change anything either, but yesterday my Xcode was updated automatically to version 16.0, and that is now leading to this problem.

Just change your Sentry version to "@sentry/react-native": "=5.32.0",, then rm -rf node_modules (and maybe run pod repo update), and then it should work again. Expo Doctor will warn that 5.32.0 is not a supported version, but I think you can ignore that.

@marcell6
Copy link

@bill-florio @agallio @marcell6 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.

but the newest sentry not support for my react native 0.61.5, any other ways?

@kahest
Copy link
Member

kahest commented Sep 20, 2024

@marcell6 the oldest RN version we support with version 5.x of the SDK is 0.65. For comparison, Meta officially supports 0.73.x and newer. It is strongly recommended you upgrade the RN version you use.

@suryav1012
Copy link

Mac OS: 15 Sequoia & XCODE-16

Fix:

update sentry version to "@sentry/react-native": "^5.31.0",

yarn install

pod update

clean build folder

build again

@ariq-d
Copy link

ariq-d commented Sep 24, 2024

I still have the issue in Xcode 16.0 RC. Using @sentry/react-native 5.24.1. Is there any workaround to fix this? I tried to patch the package to use Sentry/HybridSDK version 8.36.0, but no luck.

Image

My RN app was working fine until I upgraded to Mac OS Sequoia and Xcode 16, then got this same error even though in the project I didn't install @sentry/react-native package, tried pod update and yarn upgrade but the error still persist. How do I fix this? Tried other solutions here also didn't work.

@fbeccaceci
Copy link

Using version 5.33.1 everything builds correctly but i cannot get the js/ts sourcemaps to be uploaded automatically when building on ios

@DevLalla
Copy link

Mac OS: 15 Sequoia & XCODE-16

Fix:

update sentry version to "@sentry/react-native": "^5.31.0",

yarn install

pod update

clean build folder

build again

**
Amazing!
Life Saved on Deployment Day
♥️
**

@tochfrogmi
Copy link

i change the solution @diazgonza17 to

  if target.name == 'Rollbar'
     file_path = 'Pods/Rollbar/KSCrash/Source/KSCrash/Recording/Monitors/KSCrashMonitor_CPPException.cpp'

     if File.exist?(file_path)
        contents = File.read(file_path)
        unless contents.include?('#include <exception>')
           File.open(file_path, 'w') do |file|
              file.puts('#include <exception>')
              file.puts(contents)
           end
        end
     else
        puts "El archivo no existe: #{file_path}"
     end
  end

this is working for me in this version using xcode 16 and multi module project

@ghost
Copy link

ghost commented Oct 8, 2024

What are the steps to fix this problem?

@david-saint
Copy link

david-saint commented Oct 17, 2024

If you're wondering if there's a way to resolve this without upgrading to ^v5.31.0. I'm currently on ^1.7.2, so upgrading would be a nightmare.

I managed to fix the Xcode 16 compatibility issues by manually editing some core Pod files:

Added #include <sys/_types/_ucontext64.h> to Pods/Sentry/Core/SentryCrashMachineContext.c, following the changes in this PR: getsentry/sentry-cocoa#4244.

Added #include <exception> to Pods/Sentry/Core/SentryCrashMonitor_CPPException.cpp, based on this PR: getsentry/sentry-cocoa#4051.

While this isn't an ideal solution (since manual changes to Pods can be overwritten), it allowed me to get things working without upgrading the entire library. If anyone has a better approach or suggestions on how to automate this fix, I'd appreciate it!

@marcell6
Copy link

@david-saint yes I also did manual like you haha, when upgrading sentry, it worked, but the map source is just empty and useless 🤣, the latest version doesn't support my react native 0.61.5, so the best way for me is like you did

@chimiWangchukWangdi
Copy link

This is still happening in Expo, I just updated to the latest Xcode and the issue started. Why is this closed?

@alexkendall
Copy link

Still happening for me. XCode Version 16.0 (16A242d) React-Native 0.74.2

@kahest
Copy link
Member

kahest commented Nov 5, 2024

@chimiWangchukWangdi @alexkendall which versions of @sentry/react-native do you use? Xcode support has been added in 5.31.0. Note that you might need to manually clean pods to ensure the correct version of sentry-cocoa is used - see above.

@chimiWangchukWangdi
Copy link

@kahest I am not using @sentry/react-native, but maybe some of the packages has dependency. Do I need to update that package? I guess it will be a tough work to find that.

@kahest
Copy link
Member

kahest commented Nov 5, 2024

@chimiWangchukWangdi if you're not knowingly using Sentry, you might get a similar error from another package. Do you see sentry anywhere in the error you get? In your code/dependency tree?

@alexu96
Copy link

alexu96 commented Nov 29, 2024

Mac OS: 15 Sequoia & XCODE-16

Fix:

update sentry version to "@sentry/react-native": "^5.31.0",

yarn install

pod update

clean build folder

build again

This solves the issue but I had to upgrade my sentry version from 3.1.1 to 5.31.0 . Is there any other way to fix this without upgrading the sentry ?

@3DTOPO
Copy link

3DTOPO commented Dec 6, 2024

Xcode 16 was released 6 months ago. Why is this still happening?

What is the recommended fix, I don't mind running the latest version of Sentry.

@3DTOPO
Copy link

3DTOPO commented Dec 6, 2024

Never mind. In my Podfile using:

pod 'Sentry'

Allowed it to build. I was using:

pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git'
pod 'SentryPrivate', :git => 'https://github.com/getsentry/sentry-cocoa.git'

@sp0033212000
Copy link

I also have this problem in our legacy project that is using react-native 0.63.4 with sentry/react-native 2.6.2
Is there any way to solve this problem without bumping sentry version to the latest one?

@a-eid
Copy link

a-eid commented Dec 23, 2024

this is still an issue for us.

@krystofwoldrich
Copy link
Member

Hi @a-eid,
could you share what version of the RN SDK are you using?

@krystofwoldrich
Copy link
Member

krystofwoldrich commented Jan 7, 2025

Xcode 16 is supported by the Sentry React Native SDK https://github.com/getsentry/sentry-react-native/releases/tag/5.24.1 and newer.

We don't intend patch older releases of the SDK, please upgrade to newer SDK versions to support Xcode 16.


As a temporary fix you can copy fixes we made in he sentry-cocoa to support Xcode 16 as mentioned in #3883 (comment)


You can use the following function in your Podfile automatically patches the files, but use it with caution as it's not safe to edit edit the source files.

...

  post_install do |installer|
    react_native_post_install(...)

    unsafe_patch_old_sentry_for_xcode_16()
  end

...

def unsafe_patch_old_sentry_for_xcode_16
  file_SentryCrashMonitor_CPPException = File.join(__dir__, "Pods/Sentry/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp")
  add_to_SentryCrashMonitor_CPPException = "#include <exception>\n"

  file_SentryCrashMachineContext = File.join(__dir__, "Pods/Sentry/Sources/SentryCrash/Recording/Tools/SentryCrashMachineContext.c")
  add_to_SentryCrashMachineContext = "#include <sys/_types/_ucontext64.h>\n"

  original_content_SentryCrashMonitor_CPPException = File.read(file_SentryCrashMonitor_CPPException)
  unless original_content_SentryCrashMonitor_CPPException.include?(add_to_SentryCrashMonitor_CPPException.strip)
    File.open(file_SentryCrashMonitor_CPPException, "w") do |file|
      file.puts add_to_SentryCrashMonitor_CPPException + original_content_SentryCrashMonitor_CPPException
    end
    puts "[Sentry] Patched file: #{file_SentryCrashMonitor_CPPException}"
  else
    puts "[Sentry] No patch needed for: #{file_SentryCrashMonitor_CPPException}"
  end

  original_content_SentryCrashMachineContext = File.read(file_SentryCrashMachineContext)
  unless original_content_SentryCrashMachineContext.include?(add_to_SentryCrashMachineContext.strip)
    File.open(file_SentryCrashMachineContext, "w") do |file|
      file.puts add_to_SentryCrashMachineContext + original_content_SentryCrashMachineContext
    end
    puts "[Sentry] Patched file: #{file_SentryCrashMachineContext}"
  else
    puts "[Sentry] No patch needed for: #{file_SentryCrashMachineContext}"
  end
end

@a-eid
Copy link

a-eid commented Jan 11, 2025

@krystofwoldrich I was using RN 76, upgrading to sentry 6 fixed the issue.

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

No branches or pull requests