"Redefinition of module ..." when building for simulator
Asked Answered
E

4

8

I have an iOS xcode project that builds fine when I have Generic iOS Device selected as my destination. However, when I select any of the simulator options I the build fails with many Redefinition of module 'abcde', one error for every module defined in iOS 11.4/usr/include/module.modulemap.

The duplicate definitions are coming from Simulator - iOS 11.4/usr/include/module.modulemap. I've combed through my workspace/project settings and found no reference to the simulator. All the deployment targets are iOS 11.4.

It appears that when I build for the simulator it is including both the platform and simulator modules. How can I specify one or the other?

This problem popped up out of the blue about a day after adding cocoapods and swift code but I don't know if it is related. (The sdk/deployment targets for the pods are also iOS 11.4 and swift version is 4 (except for Socket.IO which is using 3)).

My pods project is using the generated modulemap (I haven't edited it at all):

framework module Pods_MyProjectName {
  umbrella header "Pods-MyProjectName-umbrella.h"

  export *
  module * { export * }
}

I've googled this problem over and over and haven't been able to find any solution for it. I've tried cleaning and rebuilding, deleting the contents of the Library/Developer/Xcode/DerivedData folder, deleting the pod's modulemap file, commenting out each line of the pod's modulemap file, removing all the code written since the problem began... I have the feeling that I'm looking in all the wrong places.

Eames answered 29/8, 2018 at 15:24 Comment(1)
I came into work this morning and tried building for the simulator again to get the errors to show so I could go digging again. ... The problem has evaporated overnight without any visible trace of why. Gonna chalk this up to some configuration issue that was solved by a system reboot and move on.Eames
I
6

I had the same issue with other pods. I assume the issue has to do with recursive dependecnies that are also imported explicitly. I tried all the same things as you did, although the only thing that helped me was to close xcode, run

pod deintegrate
pod install

and rebuild.

Incur answered 8/3, 2019 at 1:16 Comment(2)
Hello, this did not work on me, do you have an other suggestion ?Klement
check if the other pod in your project is using CommonCrypto inside itself. e.g. TPInAppReceiptKarimakarin
A
1

I have just ran into this with a CapacitorJS app. I have tried many of the solutions presented in the various forums and answers on here. What finally fixed it for me was I had the following environment variable set

CPATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include"

For me this was being exported in my .zshrc file so dependant on your shell I'd check for occurances of this.

Adhern answered 12/5, 2023 at 20:32 Comment(0)
V
1

If you have a module that needs a modular header, you need to add to the following sentence to your podfile:

pod 'GoogleUtilities', :modular_headers => true
Voyeur answered 22/3 at 22:6 Comment(0)
H
0

Exact reasons for this error are ::

  • If you have updated react native version.
  • If you are using firebase in your project.

Note :: In earlier version of react native there we were using Flipper , but in newer versions of react native we are going to use Kotlin . So above error is of firebase. You need to change some setting related to firebase and deprecated Flipper. I recommend to follow these steps from official website of firebase setup. https://rnfirebase.io/#altering-cocoapods-to-use-frameworks

  • Step1 :: Add these lines right above the use_react_native in pod file . Path is ./ios/Podfile

use_frameworks! :linkage => :static

$RNFirebaseAsStaticFramework = true

-Step2 :: Remove all code from podfile related to flipper.

-Step3 :: Hit this command pod install --repo-update

-Step4 :: Clean your xcode build using keys command+shift+k

-Step5 :: Run your project.

Hernia answered 23/6 at 16:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.