伯爵格雷 2 不会构建 - 未定义的符号



由于earlgray 2的pod版本目前已经相当过时,我尝试使用直接复制方法,并且有点拘泥于构建AppFramework。所以我遵循了这里的设置指南:Github 上的Earlgrey 2

git clone -b earlgrey2 https://github.com/google/EarlGrey.git
cd EarlGrey
sh Scripts/download_deps.sh

然后我在XCode中打开EarlGrey.xcodeproj文件,开始构建所有目标,除了ApppFramework之外,所有目标都构建得没有任何问题。但当我尝试构建AppFramework目标时,首先我在GreyAppStateTracker.m中遇到了一个关于使用self的错误(第361行(,我通过将_printAppStateTrackerLog更改为self->_printAppStateTrackerLog来修复了这个错误。但在第二次构建尝试中,我遇到了以下错误(如果我为arm或x86_64构建,那没关系,下面是我为arm64构建时的错误(,我无法修复:

Ld /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos/AppFramework.framework/AppFramework normal (in target 'AppFramework' from project 'EarlGrey')
cd /Users/trxx/EarlGrey
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios10.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -L/Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos -F/Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos -filelist /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Intermediates.noindex/EarlGrey.build/Debug-iphoneos/AppFramework.build/Objects-normal/arm64/AppFramework.LinkFileList -install_name @rpath/AppFramework.framework/AppFramework -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Intermediates.noindex/EarlGrey.build/Debug-iphoneos/AppFramework.build/Objects-normal/arm64/AppFramework_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -framework IOKit -ObjC -lUILib -framework IOKit -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Intermediates.noindex/EarlGrey.build/Debug-iphoneos/AppFramework.build/Objects-normal/arm64/AppFramework_dependency_info.dat -o /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos/AppFramework.framework/AppFramework
Undefined symbols for architecture arm64:
"_GREYKeyForAppState", referenced from:
___133-[GREYAppStateTracker grey_changeState:usingOperation:forObject:orInternalObjectDeallocationTracker:orExternalAppStateTrackerObject:]_block_invoke in GREYAppStateTracker.o
"_GREYLogVerbose", referenced from:
-[GREYUIThreadExecutor drainForTime:] in GREYUIThreadExecutor.o
-[GREYUIThreadExecutor drainUntilIdle] in GREYUIThreadExecutor.o
-[GREYUIThreadExecutor drainUntilIdleWithTimeout:] in GREYUIThreadExecutor.o
-[UIViewController(GREYApp) greyswizzled_viewWillAppear:] in UIViewController+GREYApp.o
-[UIViewController(GREYApp) greyswizzled_viewWillDisappear:] in UIViewController+GREYApp.o
_ToggleShiftKeyWithError in GREYKeyboard.o
-[GREYSlideAction grey_perform:error:] in GREYSlideAction.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)      

我不太清楚为什么它看不到这些符号。。。如有任何帮助,我们将不胜感激。我使用XCode 12.0只是以防万一。

我遇到了同样的问题。看看的两个文件

CommonLib/Config/GREYAppState.mu2028

CommonLib/GREYLogger.m

它们当前不是项目的一部分,但应该是。添加它们,并确保两者的目标成员资格都设置为AppFramework。之后,AppFramework在我的系统上正确构建。

最新更新