Skip to content

Undefined symbols for architecture x86_64 (OSX with clang 21.1.7) #7

@ClausKlein

Description

@ClausKlein
bash-5.3$ cmake --preset llvm-debug --fresh --log-level VERBOSE
Preset CMake variables:

  BEMAN_BUILDSYS_SANITIZER="MaxSan"
  CMAKE_BUILD_TYPE="Debug"
  CMAKE_CXX_STANDARD="20"
  CMAKE_EXPORT_COMPILE_COMMANDS="ON"
  CMAKE_PROJECT_TOP_LEVEL_INCLUDES="./infra/cmake/use-fetch-content.cmake"
  CMAKE_TOOLCHAIN_FILE="infra/cmake/llvm-toolchain.cmake"

-- The CXX compiler identification is Clang 21.1.7
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/Cellar/llvm/21.1.7/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is Clang 21.1.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/Cellar/llvm/21.1.7/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
Examples to be built: take_before_direct_usage
-- Configuring done (3.1s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug
bash-5.3$ 

bash-5.3$ cmake --build --preset llvm-debug 
[6/9] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/_deps/googletest-src/googletest/src/gtest-all.cc:38:
In file included from /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/_deps/googletest-src/googletest/include/gtest/gtest.h:64:
In file included from /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/_deps/googletest-src/googletest/include/gtest/gtest-death-test.h:43:
In file included from /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/_deps/googletest-src/googletest/include/gtest/internal/gtest-death-test-internal.h:47:
In file included from /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/_deps/googletest-src/googletest/include/gtest/gtest-matchers.h:49:
/Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/_deps/googletest-src/googletest/include/gtest/gtest-printers.h:528:35: warning: implicit conversion from 'char8_t' to 'char32_t' may change the meaning of the represented code unit [-Wcharacter-conversion]
  528 |   PrintTo(ImplicitCast_<char32_t>(c), os);
      |           ~~~~~~~~~~~~~           ^
1 warning generated.
[9/9] Linking CXX executable tests/beman/take_before/beman_take_before.test
FAILED: [code=1] tests/beman/take_before/beman_take_before.test tests/beman/take_before/beman_take_before.test[1]_tests.cmake /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/tests/beman/take_before/beman_take_before.test[1]_tests.cmake 
: && /usr/local/Cellar/llvm/21.1.7/bin/clang++ -fsanitize=address -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined -fsanitize-undefined-trap-on-error -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names tests/beman/take_before/CMakeFiles/beman_take_before.test.dir/take_before.test.cpp.o -o tests/beman/take_before/beman_take_before.test  lib/libgtest.a  lib/libgtest_main.a  lib/libgtest.a && cd /Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/tests/beman/take_before && /Users/clausklein/.direnv/python-3.14/lib/python3.14/site-packages/cmake/data/bin/cmake -D TEST_TARGET=beman_take_before.test -D TEST_EXECUTABLE=/Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/tests/beman/take_before/beman_take_before.test -D TEST_EXECUTOR= -D TEST_WORKING_DIR=/Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/tests/beman/take_before -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=beman_take_before.test_TESTS -D CTEST_FILE=/Users/clausklein/Workspace/cpp/beman-project/take_before/build/llvm-debug/tests/beman/take_before/beman_take_before.test[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=5 -D TEST_DISCOVERY_EXTRA_ARGS= -D TEST_XML_OUTPUT_DIR= -P /Users/clausklein/.direnv/python-3.14/lib/python3.14/site-packages/cmake/data/share/cmake-4.2/Modules/GoogleTestAddTests.cmake
ld: warning: ignoring duplicate libraries: 'lib/libgtest.a'
Undefined symbols for architecture x86_64:
  "std::__1::__hash_memory(void const*, unsigned long)", referenced from:
      ltmp582 in libgtest.a[2](gtest-all.cc.o)
ld: symbol(s) not found for architecture x86_64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
bash-5.3$ 

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