google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
6.93k stars 2.05k forks source link

How do you solve this problem during installation? #1088

Closed WYKXD closed 4 months ago

WYKXD commented 4 months ago

How do you solve this problem during installation?

usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI23Logging_FatalThrow_Test[_ZTI23Logging_FatalThrow_Test]+0x10): undefined reference to typeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI34EmailLogging_MaliciousAddress_Test[_ZTI34EmailLogging_MaliciousAddress_Test]+0x10): undefined reference totypeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI32EmailLogging_InvalidAddress_Test[_ZTI32EmailLogging_InvalidAddress_Test]+0x10): undefined reference to typeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI35EmailLogging_MultipleAddresses_Test[_ZTI35EmailLogging_MultipleAddresses_Test]+0x10): undefined reference totypeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI30EmailLogging_ValidAddress_Test[_ZTI30EmailLogging_ValidAddress_Test]+0x10): undefined reference to typeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI22LogMsgTime_gmtoff_Test[_ZTI22LogMsgTime_gmtoff_Test]+0x10): more undefined references totypeinfo for testing::Test' follow /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTIN7testing8internal16TypedExpectationIFvN6google11LogSeverityERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_EEE[_ZTIN7testing8internal16TypedExpectationIFvN6google11LogSeverityERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_EEE]+0x10): undefined reference to typeinfo for testing::internal::ExpectationBase' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI16DVLog_Basic_Test[_ZTI16DVLog_Basic_Test]+0x10): undefined reference totypeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI21Strerror_logging_Test[_ZTI21Strerror_logging_Test]+0x10): undefined reference to typeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI24SafeFNMatch_logging_Test[_ZTI24SafeFNMatch_logging_Test]+0x10): undefined reference totypeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI24DeathCheckNN_Simple_Test[_ZTI24DeathCheckNN_Simple_Test]+0x10): undefined reference to typeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI24CheckNOTNULL_Simple_Test[_ZTI24CheckNOTNULL_Simple_Test]+0x10): undefined reference totypeinfo for testing::Test' /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTI23DeathSTREQ_logging_Test[_ZTI23DeathSTREQ_logging_Test]+0x10): more undefined references to typeinfo for testing::Test' follow /usr/bin/ld: CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o:(.data.rel.ro._ZTIN7testing8internal14FunctionMockerIFvN6google11LogSeverityERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_EEE[_ZTIN7testing8internal14FunctionMockerIFvN6google11LogSeverityERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_EEE]+0x10): undefined reference totypeinfo for testing::internal::UntypedFunctionMockerBase' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/logging_unittest.dir/build.make:109:logging_unittest] 错误 1 make[1]: [CMakeFiles/Makefile2:921:CMakeFiles/logging_unittest.dir/all] 错误 2 make: *** [Makefile:166:all] 错误 2

sergiud commented 4 months ago

Have you tried asking the maintainers of the distro/package management you are using? We do not observe this error in our CI which indicates a broken gtest installation on your side.

See also https://github.com/google/glog/issues/932#issuecomment-1848381564 for other options.