DataDog / dd-sdk-ios

Datadog SDK for iOS - Swift and Objective-C.
Apache License 2.0
222 stars 129 forks source link

Could not find module 'DatadogInternal' for target 'x86_64-apple-ios-simulator' #1505

Closed rs-georg closed 1 year ago

rs-georg commented 1 year ago

The issue

When building in Xcode I get the following error

{redacted}/app/iosApp/Pods/  {redacted}/app/shared/build/cocoapods/synthetic/ios/Pods/DatadogLogs/DatadogLogs/Sources/ConsoleLogger.swift:8:8 could not find module 'DatadogInternal' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at: {redacted}/Library/Developer/Xcode/DerivedData/iosApp-bomxiyutitnfegeubhgsncbazkkx/Build/Products/Debug-iphonesimulator/DatadogInternal/DatadogInternal.swiftmodule

Datadog SDK version:

2.2.1

Last working Datadog SDK version:

I don't know. I've never used DataDog before.

Dependency Manager:

Cocoapods 1.13.0

Other toolset:

no

Xcode version:

14.3.1

Swift version:

5.0

Deployment Target:

iOS 15

macOS version:

none

maciejburda commented 1 year ago

Thanks @rs-georg for reporting!

I tested using Xcode 14.3.1 and Cocoapods 1.13.0 and it seems to work without issues. I'm attaching a fresh project that I created as a test: CPTest1431.zip

I also tried creating fresh project using Cocoapods 1.13.0 using Xcode 15. I encountered this issue. Setting ENABLE_USER_SCRIPT_SANDBOXING to false resolved it to me.

Could you please share your exact definition of Datadog targets in the Podfile? If it's not too big of an ask, could you try to reproduce this in a fresh project?

rs-georg commented 1 year ago

Hi @maciejburda

thanks for your fast reply and for looking into it. I tested your project and it works fine. I've looked into my problem some more and was able to resolve it. Here is what I did in case anyone encounters the same issue.

The project is setup using Kotlin Multiplatform. This is the CocoaPods config in Gradle that worked in the end.

cocoapods {
        version = "1.0.0"
        summary = "XXX"
        homepage = "XXX"
        name = "XXX"
        ios.deploymentTarget = "15.0"

        framework {
            baseName = "XXX"
            isStatic = true
            embedBitcode(BitcodeEmbeddingMode.BITCODE)
            linkerOpts.add("-lsqlite3")
        }

        pod("DatadogObjc") {
            version = "2.2.1"
            extraOpts = listOf("-compiler-option", "-fmodules")
        }
        pod("DatadogCrashReporting") {
            version = "2.2.1"
            extraOpts = listOf("-compiler-option", "-fmodules")
        }

        xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
        xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE
    }

Additionally I deleted and reinstalled CocoaPods. Also deleted the Pods directory, the Podfile.lock file and the .xcworkspace. Then generated everything again with pod install.

maciejburda commented 1 year ago

Great news @rs-georg !

Thanks for sharing the additional context with your KMM setup 🙇