Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gemma.cpp$ cmake --build builddir: undefined reference to `testing #501

Open
raphael10-collab opened this issue Feb 13, 2025 · 1 comment
Assignees
Labels
type:support Support issues

Comments

@raphael10-collab
Copy link

Hi,

Building phase seems fine :

(base) raphy@raohy:~/gemma.cpp$ cmake -B builddir -Wno-dev
-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test ATOMICS_LOCK_FREE_INSTRUCTIONS
-- Performing Test ATOMICS_LOCK_FREE_INSTRUCTIONS - Success
-- Performing Test HWY_EMSCRIPTEN
-- Performing Test HWY_EMSCRIPTEN - Failed
-- Performing Test HWY_RISCV
-- Performing Test HWY_RISCV - Failed
-- Looking for sys/auxv.h
-- Looking for sys/auxv.h - found
-- Looking for asm/hwcap.h
-- Looking for asm/hwcap.h - not found
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/raphy/gemma.cpp/builddir/_deps/highway-build/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
HEAD is now at 43efa0a4 Merge pull request #3617 from Bagira80:fix_3616
[ 33%] Performing update step for 'googletest'
-- Already at requested ref: 43efa0a4efd40c78b9210d15373112081899a97c
[ 44%] No patch step for 'googletest'
[ 55%] No configure step for 'googletest'
[ 66%] No build step for 'googletest'
[ 77%] No install step for 'googletest'
[ 88%] No test step for 'googletest'
[100%] Completed 'googletest'
[100%] Built target googletest
-- Found Python: /home/raphy/miniconda3/bin/python3.12 (found version "3.12.8") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- VERSION: 0.2.0
-- Found TCMalloc: /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so
-- Using the multi-header code from /home/raphy/gemma.cpp/builddir/_deps/json-src/include/
-- Failed to find LLVM FileCheck
-- Found Git: /usr/bin/git (found version "2.43.0")
-- git version: v1.8.2 normalized to 1.8.2
-- Google Benchmark version: 1.8.2
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST
-- Performing Test HAVE_CXX_FLAG_WOLD_STYLE_CAST - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE
-- Performing Test HAVE_CXX_FLAG_WSUGGEST_OVERRIDE - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Compiling and running to test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Compiling and running to test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Compiling and running to test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Compiling and running to test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Compiling and running to test HAVE_PTHREAD_AFFINITY
-- Performing Test HAVE_PTHREAD_AFFINITY -- success
-- Configuring done (22.3s)
-- Generating done (0.2s)
-- Build files have been written to: /home/raphy/gemma.cpp/builddir
(base) raphy@raohy:~/gemma.cpp$

But the subsequent phase gives "unefined reference to" errors:

(base) raphy@raohy:~/gemma.cpp$ cmake --build builddir/

[ 84%] Building CXX object CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o
[ 84%] Linking CXX executable gemma_batch_bench
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `gcpp::(anonymous namespace)::GemmaTest_RandomQuestionsBatched_Test::~GemmaTest_RandomQuestionsBatched_Test()':
gemma_batch_bench.cc:(.text+0x53): undefined reference to `testing::Test::~Test()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `testing::internal::TestFactoryImpl<gcpp::(anonymous namespace)::GemmaTest_RandomQuestionsBatched_Test>::CreateTest()':
gemma_batch_bench.cc:(.text+0x8c): undefined reference to `testing::Test::Test()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `gcpp::(anonymous namespace)::GemmaTest_RandomQuestionsBatched_Test::TestBody()':
gemma_batch_bench.cc:(.text+0xd33): undefined reference to `testing::AssertionSuccess()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2171): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x21a9): undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x21b6): undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x21be): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2269): undefined reference to `testing::AssertionFailure()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2273): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x22b6): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x232e): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2369): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x23d9): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2414): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2484): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x24bf): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x252f): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x256a): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x25da): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2615): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2685): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x26c0): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2a3a): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2a79): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2af0): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2b2b): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2e3f): undefined reference to `testing::Message::Message()'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2e7e): undefined reference to `testing::Message::GetString[abi:cxx11]() const'
/usr/bin/ld: gemma_batch_bench.cc:(.text+0x2ef4): undefined reference to `testing::AssertionResult::AssertionResult(testing::AssertionResult const&)'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `gcpp::(anonymous namespace)::GemmaTest_RandomQuestionsBatched_Test::~GemmaTest_RandomQuestionsBatched_Test()':
gemma_batch_bench.cc:(.text+0x2f): undefined reference to `testing::Test::~Test()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `gcpp::(anonymous namespace)::GemmaTest_RandomQuestionsBatched_Test::TestBody() [clone .cold]':
gemma_batch_bench.cc:(.text.unlikely+0x223): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `_GLOBAL__sub_I_main.cold':
gemma_batch_bench.cc:(.text.unlikely+0x917): undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: gemma_batch_bench.cc:(.text.unlikely+0x936): undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `main':
gemma_batch_bench.cc:(.text.startup+0x113): undefined reference to `testing::InitGoogleTest(int*, char**)'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x118): undefined reference to `testing::UnitTest::GetInstance()'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x120): undefined reference to `testing::UnitTest::Run()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o: in function `_GLOBAL__sub_I_main':
gemma_batch_bench.cc:(.text.startup+0x19d): undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x1b6): undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x225): undefined reference to `testing::internal::MakeAndRegisterTestInfo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x281): undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x2f1): undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x316): undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: gemma_batch_bench.cc:(.text.startup+0x386): undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o:(.data.rel.ro+0x28): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o:(.data.rel.ro+0x68): undefined reference to `testing::Test::SetUp()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o:(.data.rel.ro+0x70): undefined reference to `testing::Test::TearDown()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o:(.data.rel.ro+0xa8): undefined reference to `testing::Test::SetUp()'
/usr/bin/ld: CMakeFiles/gemma_batch_bench.dir/evals/gemma_batch_bench.cc.o:(.data.rel.ro+0xb0): undefined reference to `testing::Test::TearDown()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/gemma_batch_bench.dir/build.make:107: gemma_batch_bench] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:718: CMakeFiles/gemma_batch_bench.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

OS: Ubuntu 24.04
gcc: 13.3.0

How to make it work?

@Gopi-Uppari Gopi-Uppari self-assigned this Feb 17, 2025
@Gopi-Uppari Gopi-Uppari added the type:support Support issues label Feb 17, 2025
@jan-wassenberg
Copy link
Member

Hi, thanks for reporting. Looks like that target depends on GTest but we didn't add it to the link_libraries. Will fix shortly :)

copybara-service bot pushed a commit that referenced this issue Feb 17, 2025
copybara-service bot pushed a commit that referenced this issue Feb 17, 2025
copybara-service bot pushed a commit that referenced this issue Feb 17, 2025
copybara-service bot pushed a commit that referenced this issue Feb 18, 2025
copybara-service bot pushed a commit that referenced this issue Feb 21, 2025
copybara-service bot pushed a commit that referenced this issue Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:support Support issues
Projects
None yet
Development

No branches or pull requests

3 participants