質問: 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のサポートが必要です
回答: 問題の原因を自分で証明するには、 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 およびサブコンポーネントが構築されているかどうかを確認します。