Compilation Error in Sentry React Native 6.10.0: Custom Allocator std::allocator_traits Issue
[!IMPORTANT] Note from the maintainers: This issue affects many libraries, not just Sentry. It is caused by Xcode 16.3 removing a non-standard C++ feature. Read on for details. Note that if all else fails, using Xcode 16.2 should still work.
- We shipped a fix for this in
@sentry/react-native 6.10.0.- If you use
sentry-dart, upgrade to8.14.0+.sentry-cocoaincludes the fix in release8.46.0+. - If you use one of the fixed versions and still encounter the issue, it is very likely that you use another affected library (read on for more info on popular affected libraries).
- If you update all your known affected dependencies to fixed versions, and still encounter the problem, make sure you perform clean builds (delete all build artefacts, including derived data). If that doesn't help, try removing them one by one and take it from there.
- If you use
- React Native versions 0.76.8 and lower are affected - you should upgrade to 0.76.9+ to fix this issue. They will not release fixes for versions before 0.76. You can read up on the details in their GH issue
- Expo is also affected, they set up a separate info page about packages and fix versions: https://expo.dev/changelog/xcode-16-3-patches
Even though it is fixed on our side, we'll keep this issue open for a little while longer for easier discovery (ppl often don't search closed issues).
What React Native libraries do you use?
React Native without Frameworks
Are you using sentry.io or on-premise?
sentry.io (SaS)
@sentry/react-native SDK Version
6.10.0
How does your development environment look like?
After upgrading from iOS sdk version 18.4, our iOS project fails to compile. The error appears to be related to a custom allocator (ThreadMetadataInnerHashMapAllocator) used within Sentry’s profiling code. Specifically, the compiler reports that the custom allocator does not meet the requirements of std::allocator_traits. For example, error messages include references to “rebinding an allocator to the same type should result in using the same object” and “No type named ‘value_type’”, which suggest that the allocator’s definitions (possibly regarding const qualifiers and required member types) are not in line with standard expectations.
Sentry.init()
Sentry.init({
dsn: '',
tracesSampleRate: 1.0,
integrations: [new HttpClient()],
beforeSend(event) {
event.tags = {...event.tags, version: version};
return event;
},
sendDefaultPii: true,
});
Steps to Reproduce
- Upgrade iOS SDK to 18.4
- Clean the iOS project by deleting Podfile.lock, the Pods/ directory, and Xcode’s DerivedData.
- Run pod install --repo-update in the iOS directory.
- Attempt to build the project in Xcode.
Expected Result
Build Success
Actual Result
Build failed with error
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk/usr/include/c++/v1/__memory/allocator_traits.h:378:17 Static assertion failed due to requirement 'is_same<std::allocator<const sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair>, std::allocator<int>>::value': [allocator.requirements] states that rebinding an allocator to the same type should result in the original allocator
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk/usr/include/c++/v1/__memory/allocator.h:95:17 Static assertion failed due to requirement '!is_const<const sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair>::value': std::allocator does not support const types
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk/usr/include/c++/v1/__type_traits/enable_if.h:28:58 No type named 'type' in 'std::enable_if<false, int>'; 'enable_if' cannot be used to disable this declaration
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.4.sdk/usr/include/c++/v1/vector:427:50 No type named 'value_type' in 'std::allocator<const sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair>'
[!IMPORTANT] This issue affects many libraries, not just Sentry. It is caused by Xcode 16.3 removing a non-standard C++ feature. Read on for details. Note that if all else fails, using Xcode 16.2 should still work.
- We shipped a fix for this in
@sentry/react-native 6.10.0. If you usesentry-dart, upgrade to8.14.0+.sentry-cocoaincludes the fix in release8.46.0+.- If you use one of the fixed versions and still encounter the issue, it is very likely that you use another affected library (read on for more info on popular affected libraries).
- If you update all your known affected dependencies to fixed versions, and still encounter the problem, make sure you perform clean builds (delete all build artefacts, including derived data). If that doesn't help, try removing them one by one and take it from there.
- React Native versions 0.76.8 and lower are affected - you should upgrade to 0.76.9+ to fix this issue. They will not release fixes for versions before 0.76. You can read up on the details in their GH issue
- Expo is also affected, they set up a separate info page about packages and fix versions: https://expo.dev/changelog/xcode-16-3-patches
Even though it is fixed on our side, we'll keep this issue open for a little while longer for easier discovery (ppl often don't search closed issues).
i've updated our app to "react-native": "~0.77.1" and applied updates recommended here but i still have a compilation error on sentry
I'm using "@sentry/react-native": "~6.10.0"
@gdespirito you need to update to "@sentry/react-native": "~6.10.0", see https://github.com/getsentry/sentry-react-native/issues/4715#issuecomment-2774904579
@gdespirito you need to update to
"@sentry/react-native": "~6.10.0", see #4715 (comment)
Still facing the issue. am using react native expo.
This doesnt seem to be fixed on version 6.10 was something missed?
fixed for mi on 6.10.0
@shameemkpofficial-git Please check the SDK 52 patches for Xcode 16.3 and https://github.com/getsentry/sentry-react-native/issues/4715#issuecomment-2774904579 for more details on this issue.
This doesnt seem to be fixed on version 6.10 was something missed?
@fbritoferreira please also make sure that you have React Native 0.76.9+. See https://github.com/getsentry/sentry-react-native/issues/4715#issuecomment-2774904579 for more details on this.
For me the issue was I downgraded Xcode back to 16.2, but I didn't actually removed or uninstalled 16.3.
Just switching versions in the Xcode setting, made this issue pop up everytime.
I used https://www.xcodes.app/ to actually uninstall xcode version 16.3 and now it works ✌️
"@sentry/react-native": "^6.10.0" works fine now with Xcode 16.3 (16E140) - the only thing is that expo-doctor will complain expecting 6.3.0 but I guess that will be fixed on Expo's side 🤞
@sentry/[email protected] - expected version: ~6.3.0
If you don't have the option to upgrade your React Native, Expo, and Sentry version, downgrade to Xcode 16.2. These versions worked for me:
"@sentry/react-native": "^5.31.0",
"expo": "^51.0.5",
"react-native": "0.74.1",
Xcode: 16.2
"react-native": "0.75.3",
- Updated Xcode to 16.3
- Issue pop-up
- Updated Sentry to "^6.10.0" from "^6.1.0"
- Rtc folly issue
- Downgraded Xcode to 16.2
- Build succeeded
- What a mess
PS. 3 weeks after this does not work for me anymore because I can not resolve issue number 4 with downgrading to 16.2 .
Closing this now as it has been fixed on our side for a while. If you encounter this issue, read on for possible reasons and solutions.
[!IMPORTANT] This issue affects many libraries, not just Sentry. It is caused by Xcode 16.3 removing a non-standard C++ feature. Read on for details. Note that if all else fails, using Xcode 16.2 should still work.
- We shipped a fix for this in
@sentry/react-native 6.10.0.- If you use
sentry-dart, upgrade to8.14.0+.sentry-cocoaincludes the fix in release8.46.0+. - If you use one of the fixed versions and still encounter the issue, it is very likely that you use another affected library (read on for more info on popular affected libraries).
- If you update all your known affected dependencies to fixed versions, and still encounter the problem, make sure you perform clean builds (delete all build artefacts, including derived data). If that doesn't help, try removing them one by one and take it from there.
- If you use
- React Native versions 0.76.8 and lower are affected - you should upgrade to 0.76.9+ to fix this issue. They will not release fixes for versions before 0.76. You can read up on the details in their GH issue
- Expo is also affected, they set up a separate info page about packages and fix versions: https://expo.dev/changelog/xcode-16-3-patches
For me the issue was I downgraded Xcode back to 16.2, but I didn't actually removed or uninstalled 16.3.
Just switching versions in the Xcode setting, made this issue pop up everytime.
I used https://www.xcodes.app/ to actually uninstall xcode version 16.3 and now it works ✌️
The working solution so far if someone does not want to upgrade or downgrade version. You just need to launch you app from xCodes app download it from link and it launch you desired version from there
Still present when upgrading to Xcode 16.4 (iOS 18.5), just upgrade to the latest and reinstall the pods
Getting it now when I upgraded my Mac to 26.
Also getting this on MacOS/iOS 26 (with latest sentry), did anyone find a solution?
@ecoArcGaming Please check above for the details and solution to this issue. Note that React Native versions 0.76.8 and lower are still affected.