Why is my yaml build failing test? yaml-cpp-0.6.0: handler_test.cpp:(.text+0x9f2): undefined reference to `testing::internal::GetWithoutMatchers()'

1

When I install the astronomy software purify. It needs a latest version of yaml like yaml-cpp-0.6.0 I didn't encounter any errors, standard output is like

-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /home/luochong/software/gcc7.3/bin/gcc
-- Check for working C compiler: /home/luochong/software/gcc7.3/bin/gcc -- 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: /home/luochong/software/gcc7.3/bin/g++
-- Check for working CXX compiler: /home/luochong/software/gcc7.3/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test FLAG_WEXTRA
-- Performing Test FLAG_WEXTRA - Success
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- 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  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luochong/Downloads/yaml-cpp-yaml-cpp-0.6.0/build

it looks alright. But when I input "make" in the linux shell it throws out a error in the end of the building process, seems to fail some tests. Do i need to install a separate test framework?

[100%] Linking CXX executable run-tests
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::(anonymous namespace)::HandlerSpecTest_Ex2_1_SeqScalars_Test::TestBody()':
handler_spec_test.cpp:(.text+0x9002): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x90b3): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x919a): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x9281): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_spec_test.cpp:(.text+0x9368): undefined reference to `testing::internal::GetWithoutMatchers()'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o:handler_spec_test.cpp:(.text+0x9419): more undefined references to `testing::internal::GetWithoutMatchers()' follow
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEEE20UntypedPerformActionEPKvPv]+0x9e): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, YAML::EmitterStyle::value)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE20UntypedPerformActionEPKvPv]+0xda): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE20UntypedPerformActionEPKvPv]+0xd2): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void (YAML::Mark const&, unsigned long)>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEmEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkEmEE20UntypedPerformActionEPKvPv]+0xb2): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::FunctionMocker<void ()>::UntypedPerformAction(void const*, void*) const':
handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvvEE20UntypedPerformActionEPKvPv[_ZNK7testing8internal14FunctionMockerIFvvEE20UntypedPerformActionEPKvPv]+0x8b): undefined reference to `testing::internal::IllegalDoDefault(char const*, int)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o:handler_spec_test.cpp:(.text._ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE27UntypedPerformDefaultActionEPvSD_[_ZNK7testing8internal14FunctionMockerIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE27UntypedPerformDefaultActionEPvSD_]+0x29c): more undefined references to `testing::internal::IllegalDoDefault(char const*, int)' follow
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnSequenceEnd()':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler13OnSequenceEndEv[_ZN4YAML16MockEventHandler13OnSequenceEndEv]+0x25): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnMapEnd()':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler8OnMapEndEv[_ZN4YAML16MockEventHandler8OnMapEndEv]+0x25): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnDocumentEnd()':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler13OnDocumentEndEv[_ZN4YAML16MockEventHandler13OnDocumentEndEv]+0x22): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnDocumentStart(YAML::Mark const&)':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler15OnDocumentStartERKNS_4MarkE[_ZN4YAML16MockEventHandler15OnDocumentStartERKNS_4MarkE]+0x2b): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `YAML::MockEventHandler::OnNull(YAML::Mark const&, unsigned long)':
handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler6OnNullERKNS_4MarkEm[_ZN4YAML16MockEventHandler6OnNullERKNS_4MarkEm]+0x38): undefined reference to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o:handler_spec_test.cpp:(.text._ZN4YAML16MockEventHandler7OnAliasERKNS_4MarkEm[_ZN4YAML16MockEventHandler7OnAliasERKNS_4MarkEm]+0x38): more undefined references to `testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(void*)' follow
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEEE18InternalExpectedAtEPKciS9_S9_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEEE18InternalExpectedAtEPKciS9_S9_]+0x485): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, YAML::EmitterStyle::value)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE18InternalExpectedAtEPKciSJ_SJ_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmNS2_12EmitterStyle5valueEEE18InternalExpectedAtEPKciSJ_SJ_]+0x52c): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void ()>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvvEE18InternalExpectedAtEPKciS5_S5_[_ZN7testing8internal8MockSpecIFvvEE18InternalExpectedAtEPKciS5_S5_]+0x43d): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&, unsigned long)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEmEE18InternalExpectedAtEPKciS9_S9_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkEmEE18InternalExpectedAtEPKciS9_S9_]+0x4be): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_spec_test.cpp.o: In function `testing::internal::MockSpec<void (YAML::Mark const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::InternalExpectedAt(char const*, int, char const*, char const*)':
handler_spec_test.cpp:(.text._ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE18InternalExpectedAtEPKciSH_SH_[_ZN7testing8internal8MockSpecIFvRKN4YAML4MarkERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmSD_EE18InternalExpectedAtEPKciSH_SH_]+0x52c): undefined reference to `testing::Expectation::Expectation(std::shared_ptr<testing::internal::ExpectationBase> const&)'
CMakeFiles/run-tests.dir/integration/handler_test.cpp.o: In function `YAML::(anonymous namespace)::HandlerTest_PlainScalarStartingWithQuestionMark_Test::TestBody()':
handler_test.cpp:(.text+0x9f2): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xaa3): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xb8a): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xc71): undefined reference to `testing::internal::GetWithoutMatchers()'
handler_test.cpp:(.text+0xd22): undefined reference to `testing::internal::GetWithoutMatchers()'
CMakeFiles/run-tests.dir/integration/handler_test.cpp.o:handler_test.cpp:(.text+0xd5c): more undefined references to `testing::internal::GetWithoutMatchers()' follow
collect2: error: ld returned 1 exit status
test/CMakeFiles/run-tests.dir/build.make:356: recipe for target 'test/run-tests' failed
make[2]: *** [test/run-tests] Error 1
CMakeFiles/Makefile2:221: recipe for target 'test/CMakeFiles/run-tests.dir/all' failed
make[1]: *** [test/CMakeFiles/run-tests.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

I'm so clumsy that I cannot get any useful information from the error code. I need help QAQ

DragonKeeper

Posted 2019-07-11T03:08:41.157

Reputation: 13

open the makefile with a text editor and examine. It looks like you need to install a separate test suite. – rjt – 2019-07-11T03:27:12.273

OS: ubuntu 16.04 – DragonKeeper – 2019-07-11T03:50:04.343

yaml package: https://github.com/jbeder/yaml-cpp

– DragonKeeper – 2019-07-11T03:50:25.913

if(YAML_CPP_BUILD_TESTS) enable_testing() add_subdirectory(test) endif() – rjt – 2019-07-11T04:30:34.747

Answers

0

To prove to yourself where the problem stems from, on line 24 of CMakeLists.txt, temporarily change the "Enable testing" option to off and retry:

option(YAML_CPP_BUILD_TESTS "Enable testing" ON)

if(YAML_CPP_BUILD_TESTS) enable_testing() add_subdirectory(test) endif()

Notice that yaml-cpp uses "Google Test" a

merger of the formerly separate GoogleTest and GoogleMock projects

so either there is another version of Google Test in your path or the yaml-cpp project is not automatically building the Google Test suite in its tree. So ascertain whether https://github.com/jbeder/yaml-cpp/tree/master/test and subcomponents is being built.

rjt

Posted 2019-07-11T03:08:41.157

Reputation: 878

Thx, we have managed to make yaml installed. But I am getting trouble into another issue when installing purify. T T – DragonKeeper – 2019-07-11T06:09:58.593