it-swarm-ja.com

yamlビルドがテストに失敗するのはなぜですか? yaml-cpp-0.6.0:handler_test.cpp :(。text + 0x9f2): `testing :: internal :: GetWithoutMatchers() 'への未定義の参照

天文学ソフトウェアをインストールすると、浄化されます。 yaml-cpp-0.6.0のような最新バージョンのyamlが必要です。エラーは発生しませんでした。標準出力は次のようになります。

-- 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

それは大丈夫に見えます。しかし、Linuxシェルで「make」と入力すると、ビルドプロセスの最後にエラーがスローされ、一部のテストに失敗するようです。別のテストフレームワークをインストールする必要がありますか?

[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

私はとても不器用なので、エラーコードから有用な情報を得ることができません。 QAQのサポートが必要です

1
DragonKeeper

問題の原因を自分で証明するには、 CMakeLists.txt の24行目で、一時的に[テストを有効にする]オプションをオフに変更して再試行します。

option(YAML_CPP_BUILD_TESTS "Enable testing" ON)

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

Yaml-cppが " Google Test " aを使用していることに注意してください

以前は別々だったGoogleTestプロジェクトとGoogleMockプロジェクトの合併

そのため、パスに別のバージョンのGoogle Testがあるか、yaml-cppプロジェクトがそのツリーにGoogleTestスイートを自動的に構築していません。したがって、 https://github.com/jbeder/yaml-cpp/tree/master/test およびサブコンポーネントが構築されているかどうかを確認します。

0
rjt