Skip to content

Fantom's tester does not link under AddressSanitizer: its folly build omits SanitizeLeak.cpp #59668

Closed

Description

@YevheniiKotyrlo

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

  1. git clone https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer && cd react-native-fantom-reproducer
  2. ./fantom/reproduce.sh asan-folly-sanitize-leak (needs Docker). It builds the image in fantom/Dockerfile, which is React Native's Fantom CI image with Clang and LLD from LLVM 23.1.3, clones react/react-native at main, runs yarn 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 build

buildFantomTester 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

  1. added a commit that references this issue on Oct 30, 2026
    a5e2042
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions