错误:重新定义模块“fmt”和“folly”

omk*_*cer 7 xcode cocoapods react-native react-native-cli

我尝试使用 cli 构建我的 React Native 应用程序,并出现此错误日志。Xcode 构建稳定,没有发生错误。

这是日志的一部分:

2 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
In file included from <module-includes>:23:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stdatomic.h:24:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stddef.h:102:10: fatal error: could not build module '_Builtin_stddef_max_align_t'
#include "__stddef_max_align_t.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: fatal error: could not build module 'Darwin'
#include <sys/types.h>
 ~~~~~~~~^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'ptrauth' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:717:
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/fmt.modulemap:1:8: error: redefinition of module 'fmt'
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/Flipper-Fmt.modulemap:1:8: note: previously defined here
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8: error: redefinition of module 'folly'
module folly {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/Flipper-Folly.modulemap:1:8: note: previously defined here
module folly {
       ^
2 errors generated.
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/fmt.modulemap:1:8: error: redefinition of module 'fmt'
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/Flipper-Fmt.modulemap:1:8: note: previously defined here
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8: error: redefinition of module 'folly'
module folly {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/Flipper-Folly.modulemap:1:8: note: previously defined here
module folly {
       ^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/dispatch/dispatch.h:25:10: fatal error: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
While building module 'os_object' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/dispatch/dispatch.h:63:
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/fmt.modulemap:1:8: error: redefinition of module 'fmt'
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/Flipper-Fmt.modulemap:1:8: note: previously defined here
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8: error: redefinition of module 'folly'
module folly {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/Flipper-Folly.modulemap:1:8: note: previously defined here
module folly {
       ^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
While building module 'os_object' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/dispatch/dispatch.h:63:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/os/object.h:25:10: fatal error: could not build module 'Darwin'
#include <Availability.h>
 ~~~~~~~~^
3 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
While building module 'os_workgroup' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/dispatch/dispatch.h:64:
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/fmt.modulemap:1:8: error: redefinition of module 'fmt'
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/Flipper-Fmt.modulemap:1:8: note: previously defined here
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8: error: redefinition of module 'folly'
module folly {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/Flipper-Folly.modulemap:1:8: note: previously defined here
module folly {
       ^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
While building module 'os_workgroup' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/dispatch/dispatch.h:64:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/os/workgroup.h:29:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/os/workgroup_base.h:8:10: fatal error: could not build module 'Darwin'
#include <sys/types.h>
 ~~~~~~~~^
3 errors generated.
9 errors generated.
19 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6:
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/fmt.modulemap:1:8: error: redefinition of module 'fmt'
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/Flipper-Fmt.modulemap:1:8: note: previously defined here
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8: error: redefinition of module 'folly'
module folly {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/Flipper-Folly.modulemap:1:8: note: previously defined here
module folly {
       ^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/usr/include/objc/./NSObjCRuntime.h:8:10: fatal error: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
3 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'Security' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/fmt.modulemap:1:8: error: redefinition of module 'fmt'
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/Flipper-Fmt.modulemap:1:8: note: previously defined here
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8: error: redefinition of module 'folly'
module folly {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/Flipper-Folly.modulemap:1:8: note: previously defined here
module folly {
       ^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'Security' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:27:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:27:10: fatal error: could not build module 'Darwin'
#include <TargetConditionals.h>
 ~~~~~~~~^
3 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreServices' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15:
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/fmt.modulemap:1:8: error: redefinition of module 'fmt'
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/fmt/Flipper-Fmt.modulemap:1:8: note: previously defined here
module fmt {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8: error: redefinition of module 'folly'
module folly {
       ^
/Users/omerkocer/tekvetek/ios/Pods/Headers/Public/folly/Flipper-Folly.modulemap:1:8: note: previously defined here
module folly {
       ^
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreServices' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:15:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:9:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreServices.framework/Headers/UTCoreTypes.h:19:10: fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
 ~~~~~~~~^
3 errors generated.
31 errors generated.
/Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:9: fatal error: could not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~^
34 errors generated.


** BUILD FAILED **


The following build commands failed:
        CompileC /Users/omerkocer/tekvetek/ios/build/Pods.build/Debug-iphonesimulator/Pods-tekvetek_RN-OneSignalNotificationServiceExtension.build/Objects-normal/x86_64/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.o /Users/omerkocer/tekvetek/ios/Pods/Target\ Support\ Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'Pods-tekvetek_RN-OneSignalNotificationServiceExtension' from project 'Pods')
(1 failure)
Run Code Online (Sandbox Code Playgroud)

尝试过这个解决方案,但它们不适用于我的情况:

1.

  • 吊舱解体
  • 吊舱安装

2.

  • 在“构建设置”选项卡中将“允许框架模块中的非模块化包含”设置“是”

3.

  • 删除所有缓存的 pod 并再次安装 pod。

Ale*_*akh 2

在我的 pod 文件中启用后,我收到此错误use_modular_headers!,我的一些 pod 需要它,从而导致错误no module found。因此,我没有为每个 Pod 启用模块化标头,而是仅针对特定的情况进行切换:

  1. 禁用use_modular_headers!
  2. 添加:modular_headers => true到每个需要它的 Pod
pod 'POD_NAME', 'x.x.x', :modular_headers => true
Run Code Online (Sandbox Code Playgroud)