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

Broken test building #3244

Open
elapidae opened this issue Jan 13, 2025 · 0 comments
Open

Broken test building #3244

elapidae opened this issue Jan 13, 2025 · 0 comments
Labels
needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@elapidae
Copy link

I build a project on Linux Mint 22.
Using cmake build.

$ uname -a
Linux --- 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:19:16 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

First cmake command output (which is not works):

-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building for architecture ARCH=x64
-- OPENTELEMETRY_ABI_VERSION_NO=1
-- OPENTELEMETRY_VERSION=1.18.0
-- Performing Test check_cxx_compiler_flag_-Wno-type-limits
-- Performing Test check_cxx_compiler_flag_-Wno-type-limits - Success
-- Performing Test check_cxx_compiler_flag_-Wno-deprecated-declarations
-- Performing Test check_cxx_compiler_flag_-Wno-deprecated-declarations - Success
-- Performing Test check_cxx_compiler_flag_-Wno-unused-parameter
-- Performing Test check_cxx_compiler_flag_-Wno-unused-parameter - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found GTest: /usr/lib/x86_64-linux-gnu/libgtest.a  
-- GTEST_INCLUDE_DIRS   = /usr/include
-- GTEST_BOTH_LIBRARIES = /usr/lib/x86_64-linux-gnu/libgtest.a;/usr/lib/x86_64-linux-gnu/libgtest_main.a
-- Building WITH_STL=OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/

And had an error during build (cmake --build . --target all):

/usr/bin/ld: /usr/lib/libgtest_main.a(gtest_main.cc.o): in function `main':
gtest_main.cc:(.text+0x3a): undefined reference to `testing::InitGoogleTest(int*, char**)'
/usr/bin/ld: /usr/lib/libgtest_main.a(gtest_main.cc.o): in function `RUN_ALL_TESTS()':
gtest_main.cc:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0x9): undefined reference to `testing::UnitTest::GetInstance()'
/usr/bin/ld: gtest_main.cc:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0x11): undefined reference to `testing::UnitTest::Run()'
collect2: error: ld returned 1 exit status
make[2]: *** [sdk/test/metrics/exemplar/CMakeFiles/reservoir_cell_test.dir/build.make:90: sdk/test/metrics/exemplar/reservoir_cell_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:5418: sdk/test/metrics/exemplar/CMakeFiles/reservoir_cell_test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

So, I was broken check in this line:

if(NOT GTEST_BOTH_LIBRARIES)

And everything is OK now, take an attention, in cmake .. this output is correct:

-- GTEST_INCLUDE_DIRS   = /usr/include
-- GTEST_BOTH_LIBRARIES = GTest::gtest;GTest::gtest_main
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

1 participant