Skip to content

Android New Architecture build fails linking libsentry-tm-perf-logger.so with undefined TurboModulePerfLogger::enableLogging on RN 0.86 #6398

Description

@zhenyu-hong

Description

After using @sentry/react-native 8.17.1 in an Expo / React Native New Architecture app, npx expo run:android --device fails during the Android native build for :sentry_react-native:buildCMakeDebug[armeabi-v7a].

The failing target is the new libsentry-tm-perf-logger.so library. The linker cannot resolve facebook::react::TurboModulePerfLogger::enableLogging(...) from React Native.

This happens even though the app does not set enableTurboModuleTracking in Sentry.init.

Environment

  • @sentry/react-native: 8.17.1
  • expo: 57.0.2
  • react-native: 0.86.0
  • expo-router: ~57.0.3
  • New Architecture: newArchEnabled=true
  • Hermes: hermesEnabled=true
  • Android compileSdk / targetSdk: 36
  • Android minSdk: 24
  • Gradle: 9.3.1
  • Java: 17.0.19
  • Host OS: macOS 26.5.1, aarch64
  • NDK installed: 27.0.12077973, 27.1.12297006, 29.0.13599879, 29.0.14206865, 30.0.14904198
  • CMake installed: 3.22.1, 3.30.5, 4.0.2, 4.0.3, 4.1.2

Android config:

reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
newArchEnabled=true
hermesEnabled=true

The Expo CLI command printed at the end includes -PreactNativeArchitectures=arm64-v8a, but the failing Sentry task is still :sentry_react-native:buildCMakeDebug[armeabi-v7a].

Reproduction

  1. Use an Expo 57 / React Native 0.86 app with New Architecture enabled.
  2. Install/configure @sentry/react-native@8.17.1 with the Expo plugin.
  3. Do not set enableTurboModuleTracking in Sentry.init.
  4. Run:
npx expo run:android --device

Expected behavior

The Android debug build succeeds. If TurboModule performance tracking is experimental and opt-in, the native perf logger should either link successfully for supported RN versions/ABIs or not break builds when the option is not enabled.

Actual behavior

The build fails while linking libsentry-tm-perf-logger.so:

> Task :sentry_react-native:buildCMakeDebug[armeabi-v7a] FAILED
C/C++: ninja: Entering directory `.../node_modules/@sentry/react-native/android/.cxx/Debug/6a511s2b/armeabi-v7a'
C/C++: ld.lld: error: undefined symbol: facebook::react::TurboModulePerfLogger::enableLogging(std::__ndk1::unique_ptr<facebook::react::NativeModulePerfLogger, std::__ndk1::default_delete<facebook::react::NativeModulePerfLogger>>&&)
C/C++: >>> referenced by SentryTurboModulePerfLogger.cpp:210 (.../node_modules/@sentry/react-native/cpp/SentryTurboModulePerfLogger.cpp:210)
C/C++: >>>               CMakeFiles/sentry-tm-perf-logger.dir/.../node_modules/@sentry/react-native/cpp/SentryTurboModulePerfLogger.cpp.o:(sentry::reactnative::SentryTurboModulePerfController::install())
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)
C/C++: ninja: build stopped: subcommand failed.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sentry_react-native:buildCMakeDebug[armeabi-v7a]'.

The full linker invocation includes:

.../Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi24 ... -shared -Wl,-soname,libsentry-tm-perf-logger.so ... -latomic -lm

Additional context

From the installed package, the failing call is in node_modules/@sentry/react-native/cpp/SentryTurboModulePerfLogger.cpp:

facebook::react::TurboModulePerfLogger::enableLogging(std::make_unique<ForwardingLogger>());

I searched existing issues and found the related libsentry-tm-perf-logger.so 16 KB alignment issue in 8.17.0, but I did not find an existing report for this undefined symbol link failure.

Metadata

Metadata

Assignees

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions