I've been implementing some tests in an iOS project and running the test suite in the command line is working fine on my local machine. Since the goal is to run the test suite every time a new commit is pushed to the repository, I decided to write a script to be used in a Github Action to run the tests.
Running the tests in the Github Action fail with undefined symbols because there is an issue related with the GoogleMapsCore.framework
:
2022-07-26T15:13:15.2276100Z ld: warning: ignoring file /Users/runner/work/<redacted>/Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework/GoogleMapsCore, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )
2022-07-26T15:13:15.6431750Z Undefined symbols for architecture x86_64:
2022-07-26T15:13:15.6432130Z "_OBJC_CLASS_$_GMSVectorTileRequestBuilder", referenced from:
2022-07-26T15:13:15.6455770Z _OBJC_CLASS_$_GMSSDKTileRequestBuilder in GoogleMaps
...
I already checked the GoogleMapsCore.framework
and everything looks fine. It doesn't make sense. The compiler is building for iOS Simulator-x86_64, which is correct, but saying that the GoogleMapsCore.framework
was built for an unknown-unsupported file format is odd! The framework is coming from Google and the binary looks good. It's like the file is corrupted.
Any clue of what might be the issue?
Here's the YML file used in the Github Action:
on: pull_request
name: PR
jobs:
iOS:
name: Unit Tests
runs-on: macos-11.0
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=15.0,name=iPhone 13']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: |
pod install
sudo xcode-select -s /Applications/Xcode_13.1.app/Contents/Developer; xcodebuild -version
xcodebuild build test -workspace ./<redacted>.xcworkspace -scheme <redacted>App-Stage -destination "${destination}"
env:
destination: ${{ matrix.destination }}
CodePudding user response:
I found the solution while discussing the issue with a friend.
So, the project has the GoogleMapsCore.framework
stored in LFS (Git Large File Storage). Because the framework is very large, the file has been added to LFS and the script is not pulling that file from the storage. That's why the file format is not valid because the repository has only a link to the original file. Now the error message does makes sense.
cat .gitattributes
Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework/GoogleMapsCore filter=lfs diff=lfs merge=lfs -text
The script should pull the files from LFS like this:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: true