Skip to content

LC0 compilation BUG on macOS #2346

@Chess321

Description

@Chess321

Linker Error: Undefined symbols (libc++) when compiling gtest on macOS arm64 (Homebrew LLVM)

I am encountering a linker failure when compiling version lc0-0.32.0 on an Apple Silicon. The issue appears to be related to the C++ standard library (libc++) not being correctly linked.

This exact build process was successful with previous versions of the compiler and build system on the same machine. I suspect that a recent update to Homebrew LLVM or the Meson/Ninja build tools might have altered how linker flags are passed.

🐛 Error Description

The build fails during the linking stage of the googletest subproject because symbols from the C++ standard library cannot be found.

Relevant Snippet from the Build Log:

[122/325] Linking target subprojects/g...st-1.15.2/googletest/libgtest-all.dyli
FAILED: [code=1] subprojects/googletest-1.15.2/googletest/libgtest-all.dylib 

# The linker command shows the use of Homebrew Clang and the -nostdinc++ flag
/opt/homebrew/opt/llvm/bin/clang++  -o subprojects/googletest-1.15.2/googletest/libgtest-all.dylib [...] -nostdinc++

# The missing symbols belong to libc++ (std::__1)
Undefined symbols for architecture arm64:
  "std::__1::__hash_memory(void const*, unsigned long)", referenced from:
      testing::internal::(anonymous namespace)::UnitTestFilter::UnitTestFilter(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in lto.o
      # ... further std::__1:: symbols
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)


OS:	macOS 26.1 25B78 arm64
Host:	MacBook Pro M1 Max
Compiler (C++):	/opt/homebrew/opt/llvm/bin/clang++ (Homebrew clang version 21.1.5)
Shell:	/bin/zsh 5.9
Build System:	Meson 1.9.1 / Ninja 1.13.1
lc0 Version:	0.32.0

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