Skip to content

[Bug]: Missing symbol when compiling 32-bit monolithic shared libs with lld-link (MSVC-like) #2035

Description

@hukeyue

Describe the issue

All definitions defined by ABSL_INTERNAL_C_SYMBOL are not found by lld-link

$ninja abseil_dll

lld-link: error: <root>: undefined symbol: __AbslContainerInternalSampleEverything
lld-link: error: <root>: undefined symbol: __AbslInternalMutexYield
lld-link: error: <root>: undefined symbol: __AbslInternalOnFatalLogMessage
lld-link: error: <root>: undefined symbol: __AbslInternalPerThreadSemInit
lld-link: error: <root>: undefined symbol: __AbslInternalPerThreadSemPoke
lld-link: error: <root>: undefined symbol: __AbslInternalPerThreadSemPost
lld-link: error: <root>: undefined symbol: __AbslInternalPerThreadSemWait
lld-link: error: <root>: undefined symbol: __AbslInternalSleepFor
lld-link: error: <root>: undefined symbol: __AbslInternalSpinLockDelay
lld-link: error: <root>: undefined symbol: __AbslInternalSpinLockWake
lld-link: error: <root>: undefined symbol: __AbslInternalTraceContinue
lld-link: error: <root>: undefined symbol: __AbslInternalTraceObserved
lld-link: error: <root>: undefined symbol: __AbslInternalTraceSignal
lld-link: error: <root>: undefined symbol: __AbslInternalTraceWait
lld-link: error: <root>: undefined symbol: ____local_stdio_printf_options
lld-link: error: <root>: undefined symbol: __fprintf
lld-link: error: <root>: undefined symbol: __snprintf

cmake command are like

LLVM_PATH=$HOME/clang+llvm-22.1.3-arm64-apple-darwin20.1.0
cmake -G Ninja \
   -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on \
   -DABSL_ENABLE_INSTALL=off \
   -DBUILD_SHARED_LIBS=on \
   -DABSL_MSVC_STATIC_RUNTIME=off \
   -DCMAKE_BUILD_TYPE=Release \
   -DCMAKE_TOOLCHAIN_FILE=$HOME/vstoolchain/cmake/platforms/WinMsvc.cmake \
   -DHOST_ARCH=$WITH_CPU \
   -DCMAKE_RC_COMPILER=$HOME/vstoolchain/llvm-rc \
   -DCMAKE_MT=$HOME/vstoolchain/llvm-mt \
   -DCMAKE_NM=$HOME/vstoolchain/llvm-nm \
   -DLLVM_NATIVE_TOOLCHAIN=$LLVM_PATH \
   "-DMSVC_BASE=$HOME/vstoolchain/VC/Tools/MSVC/14.50.35717" \
   "-DWINSDK_BASE=$HOME/vstoolchain/Windows Kits/10" \
   -DWINSDK_VER=10.0.26100.0 \
   ..

Steps to reproduce the problem

  1. generate zip tarball with depot_tools' package_from_installed.py script, make sure you have visual studio 2026 installed.
  2. cd $HOME && git clone https://github.com/hukeyue/vstoolchain
  3. extract the zip from step1 into $HOME/vstoolchain
  4. cd $HOME && git clone https://github.com/abseil/abseil-cpp
  5. cd $HOME/vstoolchain && WITH_CPU=x86 ./build-abseil.sh
  6. cd $HOME/abseil-cpp/build-msvc-x86-dynamic && ninja abseil_dll

What version of Abseil are you using?

04f3bc0

What operating system and version are you using?

macOS Darwin Kernel Version 25.4.0: Thu Mar 19 19:31:56 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T6030

What compiler and version are you using?

➜ ~ ~/clang+llvm-22.1.3-arm64-apple-darwin20.1.0/bin/clang -v
clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
Target: arm64-apple-darwin25.4.0
Thread model: posix
InstalledDir: /Users/keeyou/clang+llvm-22.1.3-arm64-apple-darwin20.1.0/bin

What build system are you using?

➜ ~ cmake --version
cmake version 4.3.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Additional context

see https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/refs/heads/main/win_toolchain/package_from_installed.py and https://github.com/hukeyue/vstoolchain/blob/master/build-abseil.sh

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