我在使用自制GCC12和Google Test 1.13在Apple Silicon笔记本电脑上构建CMake C++项目时遇到了链接问题。
使用CMakeLists.txt文件
cmake_minimum_required(VERSION 3.15)
set(CMAKE_C_COMPILER gcc-12)
set(CMAKE_CXX_COMPILER g++-12)
project(gtest_issue)
# Locate GTest
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
add_executable(runTests GTest_main.cpp)
target_link_libraries(runTests ${GTEST_LIBRARIES})
和GTest_main. cpp包含
#include <gtest/gtest.h>
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
TEST(example, example)
{
ASSERT_TRUE(false);
}
在cmake .
之后,我从make
获得以下输出:
[ 50%] Linking CXX executable runTests
Undefined symbols for architecture arm64:
"__ZN7testing8internal30GetBoolAssertionFailureMessageB5cxx11ERKNS_15AssertionResultEPKcS5_S5_", referenced from:
__ZN20example_example_Test8TestBodyEv in GTest_main.cpp.o
"__ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4findEcm", referenced from:
__ZN7testing8internalL21FormatDeathTestOutputERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal11SplitStringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEcPNS1_6vectorIS7_NS5_IS7_EEEE in libgtest.a(gtest-all.cc.o)
"__ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEmmPKcm", referenced from:
__ZN7testing8internal16InDeathTestChildEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal23DefaultDeathTestFactory6CreateEPKcNS_7MatcherIRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEES3_iPPNS0_9DeathTestE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal29ParseInternalRunDeathTestFlagEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal20TypedTestSuitePState25VerifyRegisteredTestNamesEPKcS3_iS3_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal9EqFailureEPKcS2_RKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESB_b in libgtest.a(gtest-all.cc.o)
__ZN7testing10TestResult20ValidateTestPropertyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_12TestPropertyE in libgtest.a(gtest-all.cc.o)
__ZN7testingL37GetReservedOutputAttributesForElementERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
...
"__ZNKSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strEv", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal20StringStreamToStringEPNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13edit_distance17CreateUnifiedDiffERKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_m in libgtest.a(gtest-all.cc.o)
__ZN7testing13PrintToStringIPKcEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatHexUInt32Ej in libgtest.a(gtest-all.cc.o)
__ZN7testing13PrintToStringIPKwEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatIntWidthNEii in libgtest.a(gtest-all.cc.o)
...
"__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv", referenced from:
__ZNKSt3__113__vector_baseIPcNS_9allocatorIS1_EEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__113__vector_baseINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_IS6_EEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__113__vector_baseIN7testing14TestPartResultENS_9allocatorIS2_EEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__113__vector_baseIdNS_9allocatorIdEEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__113__vector_baseINS_6vectorIdNS_9allocatorIdEEEENS2_IS4_EEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__113__vector_baseIN7testing8internal13edit_distance8EditTypeENS_9allocatorIS4_EEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__113__vector_baseINS_6vectorIN7testing8internal13edit_distance8EditTypeENS_9allocatorIS5_EEEENS6_IS8_EEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
...
"__ZNKSt3__120__vector_base_commonILb1EE20__throw_out_of_rangeEv", referenced from:
__ZNKSt3__113__vector_baseIN7testing14TestPartResultENS_9allocatorIS2_EEE20__throw_out_of_rangeEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__113__vector_baseIN7testing12TestPropertyENS_9allocatorIS2_EEE20__throw_out_of_rangeEv in libgtest.a(gtest-all.cc.o)
"__ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv", referenced from:
__ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
__ZNKSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE20__throw_length_errorEv in libgtest.a(gtest-all.cc.o)
"__ZNKSt3__16locale9use_facetERNS0_2idE", referenced from:
__ZN7testing8internal8GTestLogC2ENS0_16GTestLogSeverityEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testinglsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_14TestPartResultE in libgtest.a(gtest-all.cc.o)
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12_GLOBAL__N_111FailureTest8TestBodyEv in libgtest.a(gtest-all.cc.o)
"__ZNKSt3__18ios_base6getlocEv", referenced from:
__ZN7testing8internal8GTestLogC2ENS0_16GTestLogSeverityEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testinglsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_14TestPartResultE in libgtest.a(gtest-all.cc.o)
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12_GLOBAL__N_111FailureTest8TestBodyEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112__next_primeEm", referenced from:
__ZNSt3__112__hash_tableINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_4hashIS6_EENS_8equal_toIS6_EENS4_IS6_EEE6rehashEm in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEmm", referenced from:
__ZN7testing8internal8FilePath9NormalizeEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal20TypedTestSuitePState25VerifyRegisteredTestNamesEPKcS3_iS3_ in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKc", referenced from:
__ZN7testing8internal13DeathTestImpl26ReadAndInterpretStatusByteEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13DeathTestImpl5AbortENS0_9DeathTest11AbortReasonE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internalL21FormatDeathTestOutputERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal16ForkingDeathTest4WaitEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15NoExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13ExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal23DefaultDeathTestFactory6CreateEPKcNS_7MatcherIRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEES3_iPPNS0_9DeathTestE in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKcm", referenced from:
__ZN7testing8internal13DeathTestImpl26ReadAndInterpretStatusByteEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13DeathTestImpl5AbortENS0_9DeathTest11AbortReasonE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internalL21FormatDeathTestOutputERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal16ForkingDeathTest4WaitEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15NoExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13ExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal23DefaultDeathTestFactory6CreateEPKcNS_7MatcherIRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEES3_iPPNS0_9DeathTestE in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEmc", referenced from:
__ZN7testingL13GetDirFromEnvESt16initializer_listIPKcES2_c in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc", referenced from:
__ZNK7testing8internal8FilePath14RemoveFileNameEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12UnitTestImpl14RecordPropertyERKNS_12TestPropertyE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal14CapturedStreamC2Ei in libgtest.a(gtest-all.cc.o)
__ZN7testing8internalL9ParseFlagINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEbPKcSA_PT_ in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6insertEmPKc", referenced from:
__ZN7testing8internal23DefaultDeathTestFactory6CreateEPKcNS_7MatcherIRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEES3_iPPNS0_9DeathTestE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15CodePointToUtf8Ej in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm", referenced from:
__ZN7testing8internal20StringStreamToStringEPNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal24XmlUnitTestResultPrinter26RemoveInvalidXmlCharactersERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9push_backEc", referenced from:
__ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EERKS9_S6_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal20StringStreamToStringEPNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal24XmlUnitTestResultPrinter26RemoveInvalidXmlCharactersERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_", referenced from:
__ZN7testing15AssertionResultC2ERKS0_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal29ParseInternalRunDeathTestFlagEv in libgtest.a(gtest-all.cc.o)
__ZNK7testing8internal8FilePath15RemoveExtensionEPKc in libgtest.a(gtest-all.cc.o)
__ZNK7testing8internal8FilePath19RemoveDirectoryNameEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8FilePath11ConcatPathsERKS1_S3_ in libgtest.a(gtest-all.cc.o)
__ZNK7testing8internal8FilePath27RemoveTrailingPathSeparatorEv in libgtest.a(gtest-all.cc.o)
__ZN7testing7MatcherIRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEC2ES9_ in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_mmRKS4_", referenced from:
__ZN7testing8internalL21FormatDeathTestOutputERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal11SplitStringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEcPNS1_6vectorIS7_NS5_IS7_EEEE in libgtest.a(gtest-all.cc.o)
__ZNK7testing8internal8FilePath15RemoveExtensionEPKc in libgtest.a(gtest-all.cc.o)
__ZNK7testing8internal8FilePath27RemoveTrailingPathSeparatorEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12_GLOBAL__N_118SplitEscapedStringERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev", referenced from:
__ZN7testing8internal20SingleFailureCheckerD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal23ScopedPrematureExitFileD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal24InternalRunDeathTestFlagD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal14GTestFlagSaverD2Ev in libgtest.a(gtest-all.cc.o)
__GLOBAL__sub_I_gtest_all.cc in libgtest.a(gtest-all.cc.o)
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_", referenced from:
__ZN7testing8internal9DeathTest27set_last_death_test_messageERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15NoExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13ExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal23DefaultDeathTestFactory6CreateEPKcNS_7MatcherIRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEES3_iPPNS0_9DeathTestE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8FilePath22GenerateUniqueFileNameERKS1_S3_PKc in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal24GetCurrentExecutableNameEv in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE3putEc", referenced from:
__ZN7testing8internal8GTestLogC2ENS0_16GTestLogSeverityEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testinglsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_14TestPartResultE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12_GLOBAL__N_111FailureTest8TestBodyEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5flushEv", referenced from:
__ZN7testing8internal8GTestLogC2ENS0_16GTestLogSeverityEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testinglsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_14TestPartResultE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12_GLOBAL__N_111FailureTest8TestBodyEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5writeEPKcl", referenced from:
__ZN7testing8internal24XmlUnitTestResultPrinter21OutputXmlCDataSectionEPNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEEPKc in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryC1ERS3_", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD1Ev", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEED2Ev", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPKv", referenced from:
__ZN7testing8internal7PrintToEPKcPNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal7PrintToEPKDsPNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal7PrintToEPKDiPNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal7PrintToEPKwPNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEd", referenced from:
__ZN7testing15AssertionResultlsIdEERS0_RKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIdEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal27FormatTimeInMillisAsSecondsEx in libgtest.a(gtest-all.cc.o)
__ZN7testing8internalL28FormatTimeInMillisAsDurationEx in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEf", referenced from:
__ZN7testing8internal15FloatingPointLEIfEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi", referenced from:
__ZN7testing8internal13DeathTestImpl26ReadAndInterpretStatusByteEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal18StreamableToStringIiEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal17Int32FromGTestEnvEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal18PrintCharAndCodeToIhEEvT_PNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal18PrintCharAndCodeToIaEEvT_PNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal18PrintCharAndCodeToIwEEvT_PNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEj", referenced from:
__ZN7testing8internal13DeathTestImpl26ReadAndInterpretStatusByteEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal7PrintToEDiPNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6Random8GenerateEj in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatHexUInt32Ej in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String10FormatByteEh in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEm", referenced from:
__ZN7testing8internal15NoExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal20PrintBytesInObjectToEPKhmPNSt3__113basic_ostreamIcNS3_11char_traitsIcEEEE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13edit_distance17CreateUnifiedDiffERKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_m in libgtest.a(gtest-all.cc.o)
"__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEx", referenced from:
__ZN7testing4Test14RecordPropertyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEx in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal18StreamableToStringIxEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
"__ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEED2Ev", referenced from:
__ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13edit_distance17CreateUnifiedDiffERKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIfEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIdEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing13PrintToStringIPKcEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatHexUInt32Ej in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal16WideStringToUtf8EPKwi in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__115basic_streambufIcNS_11char_traitsIcEEEC2Ev", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev in libgtest.a(gtest-all.cc.o)
"__ZNSt3__115basic_streambufIcNS_11char_traitsIcEEED2Ev", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13edit_distance17CreateUnifiedDiffERKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIfEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIdEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing13PrintToStringIPKcEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatHexUInt32Ej in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal16WideStringToUtf8EPKwi in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__14cerrE", referenced from:
__ZN7testing8internal13DeathTestImpl26ReadAndInterpretStatusByteEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZNK7testing8internal11MatcherBaseIRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE10DescribeToEPNS2_13basic_ostreamIcS5_EE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15NoExecDeathTest10AssumeRoleEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogC2ENS0_16GTestLogSeverityEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internalL13CaptureStreamEiPKcPPNS0_14CapturedStreamE in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__14coutE", referenced from:
__ZN7testing8internal12_GLOBAL__N_111FailureTest8TestBodyEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__15ctypeIcE2idE", referenced from:
__ZN7testing8internal8GTestLogC2ENS0_16GTestLogSeverityEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testinglsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_14TestPartResultE in libgtest.a(gtest-all.cc.o)
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12_GLOBAL__N_111FailureTest8TestBodyEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__16chrono12steady_clock3nowEv", referenced from:
__ZN7testing8TestInfo3RunEv in libgtest.a(gtest-all.cc.o)
__ZN7testing9TestSuite3RunEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12UnitTestImpl11RunAllTestsEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__16chrono12system_clock11from_time_tEl", referenced from:
__ZN7testing8internal15GetTimeInMillisEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8TestInfo3RunEv in libgtest.a(gtest-all.cc.o)
__ZN7testing9TestSuite3RunEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12UnitTestImpl11RunAllTestsEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__16chrono12system_clock3nowEv", referenced from:
__ZN7testing8internal15GetTimeInMillisEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8TestInfo3RunEv in libgtest.a(gtest-all.cc.o)
__ZN7testing9TestSuite3RunEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12UnitTestImpl11RunAllTestsEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__16localeD1Ev", referenced from:
__ZN7testing8internal8GTestLogC2ENS0_16GTestLogSeverityEPKci in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal8GTestLogD2Ev in libgtest.a(gtest-all.cc.o)
__ZN7testinglsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS_14TestPartResultE in libgtest.a(gtest-all.cc.o)
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal12_GLOBAL__N_111FailureTest8TestBodyEv in libgtest.a(gtest-all.cc.o)
"__ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
"__ZNSt3__18ios_base4initEPv", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev in libgtest.a(gtest-all.cc.o)
"__ZNSt3__18ios_base5clearEj", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libgtest.a(gtest-all.cc.o)
"__ZNSt3__19basic_iosIcNS_11char_traitsIcEEED2Ev", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13edit_distance17CreateUnifiedDiffERKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIfEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIdEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing13PrintToStringIPKcEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatHexUInt32Ej in libgtest.a(gtest-all.cc.o)
...
"__ZNSt3__1plIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_12basic_stringIT_T0_T1_EEPKS6_RKS9_", referenced from:
__ZN7testing8internal23DefaultDeathTestFactory6CreateEPKcNS_7MatcherIRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEEES3_iPPNS0_9DeathTestE in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal29ParseInternalRunDeathTestFlagEv in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal23InsertSyntheticTestCaseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS0_12CodeLocationEb in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal34TypeParameterizedTestSuiteRegistry22CheckForInstantiationsEv in libgtest.a(gtest-all.cc.o)
"__ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE", referenced from:
__ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13edit_distance17CreateUnifiedDiffERKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIfEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIdEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing13PrintToStringIPKcEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatHexUInt32Ej in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal16WideStringToUtf8EPKwi in libgtest.a(gtest-all.cc.o)
...
"__ZTTNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
"__ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
__ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal13edit_distance17CreateUnifiedDiffERKNSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEESD_m in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIfEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal15FloatingPointLEIdEENS_15AssertionResultEPKcS4_T_S5_ in libgtest.a(gtest-all.cc.o)
__ZN7testing13PrintToStringIPKcEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_ in libgtest.a(gtest-all.cc.o)
__ZN7testing8internal6String15FormatHexUInt32Ej in libgtest.a(gtest-all.cc.o)
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"__ZTVNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE", referenced from:
__ZNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEC1Ev in libgtest.a(gtest-all.cc.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"__ZTVNSt3__119basic_ostringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE", referenced from:
__ZN7testing8internal13DeathTestImpl6PassedEb in libgtest.a(gtest-all.cc.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make[2]: *** [runTests] Error 1
make[1]: *** [CMakeFiles/runTests.dir/all] Error 2
make: *** [all] Error 2
看起来CMake试图链接到与ARM64 GCC编译器不兼容的Google Test版本。我尝试过卸载和重新安装Googletest、Cmake和gcc,但这似乎没有帮助。根据formulae.brew.sh,据我所知应该没有兼容性问题。
1条答案
按热度按时间tkclm6bt1#
正如@273K所指出的,homebrew GTest是用clang编译的。