Could not build module 'nanopb' error in Xcode 12.0.1

Viewed 6690

I upgraded my Xcode to 12. Everything was working perfectly and all of a sudden I kept getting bellow error message (Image below)

enter image description here

enter image description here

SO link have tried using to solve this issue

SO Link

What I've done so far

  • Cleaned Build Folder
  • Restarted Xcode
  • Updated Cocoapods
  • Deleted DerivedData
  • Cleared pod cache
  • Deleted pods directory and file and reinstall

None of them worked and its getting frustrating.

Pod file

enter image description here

5 Answers

All I did was to follow the instruction(see image below) and it got fixed.

Source here

enter image description here

I had the same problem with a project still targeting iOS 8 as the minimum iOS version. This steps solved my problem:

  1. Update minimum target iOS version to iOS 9 on Podfile file;
  2. Open terminal on project folder, remove all pod file dependencies and update them by running:
rm -rf /Pods
pod repo update
pod install
  1. Update minimum project target iOS version to iOS 9;
  2. Remove DerivedData;
  3. Clean project;
  4. Compile/run project again.

A simpler solution is to update cocoapods to the 1.10 version

First, update the CocoaPods installation : [sudo] gem install cocoapods

Then, update your project : bundle update cocoapods

Finally, run pod install and everything should be OK :)

If the previous solutions did not help someone, then try changing it this way:

#include <nanopb/pb.h>

->

#include "nanopb/pb.h"

This issue CAN be the result of developing iOS on an M1 (Apple Silicon) machine. In this case, the only way to fix the problem is to download a Ruby extension called "ffi" which you can read about here (for extra information): https://rubygems.org/gems/ffi/versions/1.0.9

To do this:

In Terminal, install ffi onto your machine using this command:

sudo arch -x86_64 gem install ffi

Then in your project file, install your podfile with this command:

arch -x86_64 pod install

This should allow you to install your pods (especially if you were getting a "zsh: abort pod install" problem. Notice Terminal will warn you "a bug in the Ruby interpreter or extension libraries".

After this, if your pod was FireStore/FireBase you may have to get another GoogleService-Info.plist file in your project.

Related