Repository navigation
Description
Description
Fantom's tester does not link when it is built with AddressSanitizer. private/react-native-fantom/tester/third-party/folly/CMakeLists.txt compiles folly/memory/SanitizeAddress.cpp and folly/synchronization/SanitizeThread.cpp, but not folly/memory/SanitizeLeak.cpp. Under -fsanitize=address, folly's headers call folly::detail::annotate_object_collected_impl and annotate_object_leaked_impl (declared in folly/memory/SanitizeLeak.h), which only SanitizeLeak.cpp defines, so the tester's link fails on both.
FANTOM_ENABLE_ASAN selects Meta's Buck build modes only, so the open-source build gets AddressSanitizer from the compiler flags, which is how I built it. With folly/memory/SanitizeLeak.cpp added to folly_runtime_SRC, the tester links.
Steps to reproduce
git clone https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer && cd react-native-fantom-reproducer./fantom/reproduce.sh asan-folly-sanitize-leak(needs Docker). It builds the image infantom/Dockerfile, which is React Native's Fantom CI image with Clang and LLD from LLVM 23.1.3, clonesreact/react-nativeatmain, runsyarn install, and builds the tester under AddressSanitizer.
The same on a checkout of main, in that image:
export CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
export CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer -Wno-error=deprecated-literal-operator"
export LDFLAGS="-fuse-ld=lld -fsanitize=address"
yarn workspace @react-native/fantom buildbuildFantomTester fails at the tester's link; Gradle keeps the linker's output in private/react-native-fantom/build/reports/. -Wno-error=deprecated-literal-operator keeps the nlohmann_json failure in #59667 out of the way.
React Native Version
0.88.0 (reproduced on main at 54905a2)
Affected Platforms
Build - Linux
Output of npx @react-native-community/cli info
System:
OS: Linux 6.18 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (24) x64 AMD Ryzen 9 9950X3D 16-Core Processor
Memory: 116.43 GB / 125.63 GB
Shell:
version: 5.1.16
path: /bin/bash
Binaries:
Node:
version: 22.14.0
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 10.9.2
path: /usr/local/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "37"
Build Tools:
- 37.0.0
Android NDK: 28.2.13676358
IDEs:
Android Studio: Not Found
Languages:
Java:
version: 17.0.20.1
path: /usr/bin/javac
Ruby:
version: 3.0.2
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
ld.lld: error: undefined symbol: folly::detail::annotate_object_collected_impl(void const*)
ld.lld: error: undefined symbol: folly::detail::annotate_object_leaked_impl(void const*)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer
Screenshots and Videos
No response
Activity
Compile folly's SanitizeLeak.cpp in Fantom's tester