Hey All, I’m hitting a weird SPM issue in our Prod...
# touchlab-tools
a
Hey All, I’m hitting a weird SPM issue in our Prod-scheme Simulator build: Env: macOS 26, Xcode sim iOS 18.5, skie 0.10.4, kmmbridge 1.0.0, xcode 16.4 Setup:
./gradlew spmDevBuild
→ debug XCFramework with arm64-device, arm64-sim & x86_64-sim I am able to run the debug version of my app with the generated kMP spm package in any simulator and real device but the release version of the app is running only in real device , when trying to run it in simulator the build fails showing error like
Copy code
Cannot find type 'SkieSwiftFlow' in the scope   
Cannot find files from my Kotlin code....
I use umbrella module technique to build KMPModules , this is how it is configured
Copy code
listOf(
    iosArm64(),
    iosSimulatorArm64(),
    iosX64()
).forEach {
    it.binaries.framework {
        export(project(":kmm-analytics"))
        export(project(":kmm-util")) 
        //...other modules 
        export(libs.resources)
        export(libs.androidx.lifecycle.viewmodel)
        isStatic = true
        baseName = "KMMShared"
    }
}
t
Do you have at least an empty Kotlin file in the umbrella module?
a
yes, I have many kotlin (not empty)and swift files inside umbrella module
t
Could you share the whole output it gives you? And did it work before?
a
output of
./gradlew spmDevBuild ?
t
Yeah
a
Copy code
➜  kmm-modules git:(2ff0d30) ✗ ./gradlew spmDevBuild                                
Type-safe project accessors is an incubating feature.
Configuration 'iosArm64CompileKlibraries' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'skieRuntimeForIosArm64CompileKlibraries' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'iosArm64DebugFrameworkExport' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'kotlinCompilerClasspath' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'skieCompilerPlugin' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'skieSubPlugin' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'kotlinCompilerPluginClasspathIosArm64Main' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'iosSimulatorArm64CompileKlibraries' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'skieRuntimeForIosSimulatorArm64CompileKlibraries' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'iosSimulatorArm64DebugFrameworkExport' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.
Configuration 'kotlinCompilerPluginClasspathIosSimulatorArm64Main' was resolved during configuration time.
This is a build performance and scalability issue.
See <https://github.com/gradle/gradle/issues/2298>
Run with --info for a stacktrace.

> Task :kmm-common:linkDebugFrameworkIosArm64
w: Interop library /Users/Abhi/.gradle/caches/modules-2/files-2.1/dev.icerock.moko/resources-iosarm64/0.24.5/df284c9ed7a94410f8f87be1d1a9bfa20369c00d/resources-cinterop-bundleSearcher can't be exported with -Xexport-library
w: 'var KMMShared.Ktor_httpHttpStatusCode.description' was renamed to 'var KMMShared.Ktor_httpHttpStatusCode.description_' because of a name collision with an another declaration 'func KMMShared.KotlinBase.description() -> Swift.String'. Consider resolving the conflict either by changing the name in Kotlin, or via the @ObjCName annotation. You can also suppress this warning using the 'SuppressSkieWarning.NameCollision' configuration. However using renamed declarations from Swift is not recommended because their name will change if the conflict is resolved.
    (at public final val description: kotlin.String defined in io.ktor.http.HttpStatusCode from module <io.ktor:ktor-http>)

> Task :kmm-common:linkDebugFrameworkIosSimulatorArm64
w: Interop library /Users/Abhi/.gradle/caches/modules-2/files-2.1/dev.icerock.moko/resources-iossimulatorarm64/0.24.5/b88997ed1cca1458cdf5723d7550426d412c3708/resources-cinterop-bundleSearcher can't be exported with -Xexport-library
w: 'var KMMShared.Ktor_httpHttpStatusCode.description' was renamed to 'var KMMShared.Ktor_httpHttpStatusCode.description_' because of a name collision with an another declaration 'func KMMShared.KotlinBase.description() -> Swift.String'. Consider resolving the conflict either by changing the name in Kotlin, or via the @ObjCName annotation. You can also suppress this warning using the 'SuppressSkieWarning.NameCollision' configuration. However using renamed declarations from Swift is not recommended because their name will change if the conflict is resolved.
    (at public final val description: kotlin.String defined in io.ktor.http.HttpStatusCode from module <io.ktor:ktor-http>)

> Task :kmm-common:assembleKMMSharedDebugXCFramework
xcframework successfully written out to: /Users/Abhi/Documents/kmm-modules/kmm-common/build/XCFrameworks/debug/KMMShared.xcframework

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to <https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings> in the Gradle documentation.
t
I don’t see the error in this log
a
> I don’t see the error in this log there is no error in generating the spm module, the error is while running my ios app from xcode , which points to this spm module . he debug version of my ios app working fine the only issue is which the prod version of the app in xcode , for simulator its not working basing showing some classfrom my kotlin code missing
t
I see, could you share that log too?
a
something like
while running for real device it's working fine no error
t
I see so when compiling your Swift code it’s having trouble finding the things
a
yes , again only for Release + simulator debug version of the app working fine for simulators too
t
Could you take a look at the generated frameworks and compare them with the ones that work?
I mean compare the .framework directory contents
a
I am using the same framework for both release and debug app , it's just I am changing the xcode schema to prod and debug nothing else
also checked the framework for these missing file, its there!. there is something wrong with the xocde prod configuration but I dont know what
Hey@kpgalligan @Filip Dolník , It would be really helpful if you guys can help me here . Thanks in advance!
t
Could you send a screenshot of the .framework directory trees for one that works and one that doesn’t?
a
Copy code
/Users/Abhi/Documents/kmm-modules/kmm-common/build/XCFrameworks/debug/KMMShared.xcframework
├── Info.plist
├── ios-arm64
│   └── KMMShared.framework
│       ├── Headers
│       │   ├── KMMShared-Swift.h
│       │   ├── KMMShared.apinotes
│       │   └── KMMShared.h
│       ├── Info.plist
│       ├── KMMShared
│       ├── Modules
│       │   ├── KMMShared.swiftmodule
│       │   │   ├── arm64-apple-ios.abi.json
│       │   │   ├── arm64-apple-ios.private.swiftinterface
│       │   │   ├── arm64-apple-ios.swiftdoc
│       │   │   ├── arm64-apple-ios.swiftinterface
│       │   │   └── arm64-apple-ios.swiftsourceinfo
│       │   └── module.modulemap
│       ├── com.cityflo.customer.kmm:kmm-foodvending.bundle
│       │   └── Contents
│       │       ├── Info.plist
│       │       └── Resources
│       │           ├── Base.lproj
│       │           │   └── Localizable.strings
│       │           ├── en.lproj
│       │           │   └── Localizable.strings
│       │           └── files
│       ├── com.cityflo.customer.kmm:kmm-litepack.bundle
│       │   └── Contents
│       │       ├── Info.plist
│       │       └── Resources
│       │           ├── Base.lproj
│       │           │   └── Localizable.strings
│       │           ├── en.lproj
│       │           │   └── Localizable.strings
│       │           └── files
│       ├── com.cityflo.customer.kmm:kmm-payments.bundle
│       │   └── Contents
│       │       ├── Info.plist
│       │       └── Resources
│       │           ├── Base.lproj
│       │           │   └── Localizable.strings
│       │           ├── en.lproj
│       │           │   └── Localizable.strings
│       │           └── files
│       └── com.cityflo.customer.kmm:kmm-util.bundle
│           └── Contents
│               ├── Info.plist
│               └── Resources
│                   ├── Assets.car
│                   ├── Base.lproj
│                   │   └── Localizable.strings
│                   ├── en.lproj
│                   │   └── Localizable.strings
│                   └── files
└── ios-arm64_x86_64-simulator
    └── KMMShared.framework
        ├── Headers
        │   ├── KMMShared-Swift.h
        │   ├── KMMShared.apinotes
        │   └── KMMShared.h
        ├── Info.plist
        ├── KMMShared
        ├── Modules
        │   ├── KMMShared.swiftmodule
        │   │   ├── arm64-apple-ios-simulator.abi.json
        │   │   ├── arm64-apple-ios-simulator.swiftdoc
        │   │   ├── arm64-apple-ios-simulator.swiftinterface
        │   │   ├── arm64-apple-ios-simulator.swiftsourceinfo
        │   │   ├── x86_64-apple-ios-simulator.abi.json
        │   │   ├── x86_64-apple-ios-simulator.swiftdoc
        │   │   ├── x86_64-apple-ios-simulator.swiftinterface
        │   │   └── x86_64-apple-ios-simulator.swiftsourceinfo
        │   └── module.modulemap
        ├── com.cityflo.customer.kmm:kmm-foodvending.bundle
        │   └── Contents
        │       ├── Info.plist
        │       └── Resources
        │           ├── Base.lproj
        │           │   └── Localizable.strings
        │           ├── en.lproj
        │           │   └── Localizable.strings
        │           └── files
        ├── com.cityflo.customer.kmm:kmm-litepack.bundle
        │   └── Contents
        │       ├── Info.plist
        │       └── Resources
        │           ├── Base.lproj
        │           │   └── Localizable.strings
        │           ├── en.lproj
        │           │   └── Localizable.strings
        │           └── files
        ├── com.cityflo.customer.kmm:kmm-payments.bundle
        │   └── Contents
        │       ├── Info.plist
        │       └── Resources
        │           ├── Base.lproj
        │           │   └── Localizable.strings
        │           ├── en.lproj
        │           │   └── Localizable.strings
        │           └── files
        └── com.customer.kmm:kmm-util.bundle
            └── Contents
                ├── Info.plist
                └── Resources
                    ├── Assets.car
                    ├── Base.lproj
                    │   └── Localizable.strings
                    ├── en.lproj
                    │   └── Localizable.strings
                    └── files
@Tadeas Kriz as mentioned the same framewordk in working form my debug app but not for the. release app, so there is no change in the framework
f
Hi! I don’t have any ideas for what could be wrong but I would try creating a new Xcode project and trying to reproduce the issue there. In either case this should rule out quite a few options. Another thing to try is to directly integrate the framework in the Xcode project without the use of SPM. I somewhat doubt that this is a problem with the framework itself, but again this will help you narrow it down.
b
@Abhishek Agarwal can you share what you have for this build setting in your Xcode project?