해당 글에서는 React Native 환경에서 앱을 빌드하는 과정에서 발생한 오류 중 Sentry 빌드 오류에 대한 해결 방법에 대해 알아봅니다.
1) 문제점 확인
💡문제점 확인
- Xcode로 빌드를 수행중에 아래와 같은 문제가 발생하였습니다.
1. Static assertion failed due to requirement '!is_const<const sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair>::value': std::allocator does not support const types
2. 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
3. No type named 'value_type' in 'std::allocator<const sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair>'
4. No type named 'type' in 'std::enable_if<false, int>'; 'enable_if' cannot be used to disable this declaration
- 이는 구글링을 해보았을때 Xcode 16.4 버전일때, Xcode를 수행하여 빌드를 할때 Sentry에서 생기는 오류라고 합니다. 주로 Xcode 16.4 버전으로 업데이트를 하였을 경우 발생할 수 있는 오류라고 합니다.
- 상세하게는, Sentry 네이티브(iOS) 쪽 프로파일링 코드가 최신 Xcode 16.3+ / iOS 18.4~18.5 SDK에서 더 엄격해진 libc++ 규칙에 걸리면서 나는 C++ 할당자 오류라고 합니다. 핵심은 Sentry 내부에서 std::vector<const ThreadHandleMetadataPair> 같은 const 타입 컨테이너를 사용하던 부분이 표준에 맞지 않아 컴파일이 막히는 것(“std::allocator does not support const types”).이 문제라고 합니다.
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.5.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.5.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.5.sdk/usr/include/c++/v1/vector:427:50: No type named 'value_type' in 'std::allocator<const sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair>'
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.5.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
1. 개발환경 체크
💡 개발환경 체크
- 아래의 개발 환경에서 문제가 발생하였습니다.
분류
버전
react-native
0.76.9
@sentry/react-native
5.36.0
XCode
16.4 (16F6)
2) 해결방법
💡 해결방법
- 해결방법은 구글링에서 확인해봤을때, 가장 간단한 방법은 '최신버전으로 업데이트를 수행'하는 방법이라고 합니다.
💡 아래의 글을 확인해보면, @sentry/react-native: 6.10.0 버전에 이를 해결하였다고 말하고 있습니다. - 영항을 받고 있는 react-native 버전에는 0.76.8 이하 버전의 경우 영향을 받을 수 있고, 0.76.9 이상 버전으로 업데이트를 하기를 권장하고 있습니다.