1

Since the pod version of earlgrey 2 is quite outdated at this moment, I tried to use a direct copy method and kind of stuck on building AppFramework. So I followed the setup guide here: Earlgrey 2 on Github

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

Then I opened EarlGrey.xcodeproj file in XCode and started to build all targets, all targets except ApppFramework were built without any issue. But when I tried to build AppFramework target, first I got an error about using self in GreyAppStateTracker.m (line 361), which I fixed by changing _printAppStateTrackerLog to self->_printAppStateTrackerLog. But then on the second build try, I got the following error (if I build for arm or for x86_64, it doesn't matter, below is error when I build for arm64), which I cannot fix:

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)      

I'm quite not sure why it cannot see these symbols... Any help would be greatly appreciated. I'm using XCode 12.0 just in case.

Nic Nilov
  • 5,056
  • 2
  • 22
  • 37
JabbaHotep
  • 31
  • 7

1 Answers1

1

I had the same issue. Have a look at the two files

CommonLib/Config/GREYAppState.m


CommonLib/GREYLogger.m

They are currently not part of the project, but they should be. Add them, and make sure that the target membership is for both set to AppFramework. After that, the AppFramework built correctly on my system.

Christian
  • 56
  • 5