Xcode build fails on M1 with "Library not found for -lPods-*"
doug-a-brunner opened this issue · 2 comments
Bug Report
Problem
What is expected to happen?
After building the project using ionic cordova build ios --prod --release
from CLI, I can open PROJECTNAME.xcodeproj
and build/debug the app on a physical device.
What does actually happen?
The build fails in Xcode, with an error message "Library not found for -lPods-PROJECTNAME".
Information
The build process succeeds when using cordova-ios@6.3.0
, but fails with 7.0.0. I noticed that when building with 7.0.0 [!] The Podfile does not contain any dependencies
prints to the console when adding the platform and when building. This message does not appear when using 6.3.0. Interestingly, the actual content of platforms/ios/Podfile
does not seem to differ between 6.3.0 and 7.0.0.
I tried re-installing Cocoapods several different ways, since from my searches this error message usually indicates a problem with the Cocoapods installation. These included:
sudo gem install cocoapods
using system Ruby, with pinning ofactivesupport
to an old version as neededgem install cocoapods
using current Ruby installed with Homebrew viarbenv
- Same as two preceding but with
arch --x86_64
brew install cocoapods
Command or Code
The problem occurs both with my own project and when using a standard Ionic tabs
template project generated like so:
% ionic start fnord tabs --type=angular --cordova
% cd fnord
% ionic cordova platform add ios
% ionic cordova build ios
When I open fnord/platforms/ios/fnord.xcodeproj
and select Product → Build, the error occurs.
Environment, Platform, Device
Mac Mini M1 (2020), Mac OS Ventura 13.0
Version information
Cordova CLI 12.0.0
cordova-ios
7.0.0
cordova-plugin-device
2.0.2
cordova-plugin-ionic-keyboard
2.0.5
cordova-plugin-ionic-webview
5.0.0
cordova-plugin-splashscreen
5.0.2
cordova-plugin-statusbar
2.4.2
@ionic/angular
7.0.0
Ionic CLI 7.1.1
Mac OS Ventura 13.0
Xcode 14.3.1
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Try opening the PROJECTNAME.xcworkspace
file in Xcode, not the PROJECTNAME.xcodeproj
file.
Interesting, I'd tried doing that before but gave up because there were no destinations available in the scheme/destination select menu. However, when I tried again just now, it worked as expected. Experimenting a bit, it looks like it breaks if the .xcodeproj
is open at the same time as the .xcworkspace
.
I'm curious why I was able to build OK from the .xcodeproj
with previous versions of cordova-ios
, but in any case, that got me unstuck with 7.0.0; thanks very much!