Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKIE adds swift-module-cache with isStatic XCFramework option #73

Closed
meavydev opened this issue Apr 26, 2024 · 8 comments
Closed

SKIE adds swift-module-cache with isStatic XCFramework option #73

meavydev opened this issue Apr 26, 2024 · 8 comments

Comments

@meavydev
Copy link

We build our XCFramework KMP library with isStatic set to true, as it is part of a SDK:

val xcf = XCFramework("IlsLibrary")

listOf(
    iosX64(),
    iosArm64(),
    iosSimulatorArm64()
).forEach {
    it.binaries.framework {
        baseName = "IlsLibrary"
        isStatic = true
        embedBitcode(org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode.DISABLE)
        xcf.add(this)
    }
}

This ends up generating warnings in Xcode when the KMP SPM is included:

SKIE_isStatic_warnings

Setting isStatic to false fixes the warnings, presumably because swift-module-cache is not included in the XCFramework binary file.
We are using SKIE 0.6.2 but it also happens with 0.6.4.
Kotlin Gradle plugin is 1.9.22.

@meavydev meavydev changed the title SKIE adds swift-package-cache with isStatic XCFramework option SKIE adds swift-module-cache with isStatic XCFramework option Apr 26, 2024
@TadeasKriz
Copy link
Collaborator

Hi @meavydev, could you share the project or a reproducer?

@meavydev
Copy link
Author

I have cut down the project and the library in the attached .zip.
Change into "ils demo" and then do:
./gradlew :libraries:ils:buildXCFramework
We only actually use the release XCFramework, so if you look at the binary IlsLibrary:
/ils demo/libraries/ils/build/XCFrameworks/release/IlsLibrary.xcframework/ios-arm64/IlsLibrary.framework/IlsLibrary
You can search for "swift-module-cache" and see there are four references in there, which presumably cause the warnings to appear.
I should say I haven't tried using this demo XCFramework, as we actually produce a SPM from it and I don't want to corrupt our repo.
ils demo.zip
Screenshot 2024-04-26 at 17 10 29

@TadeasKriz
Copy link
Collaborator

Thanks for the reproducer. Unfortunately I don't see an Xcode project that I could see the warnings in. Could you show the full warnings that Xcode is showing?

@meavydev
Copy link
Author

meavydev commented May 8, 2024

I can't generate an Xcode project to demonstrate as we generate a private SPM which is hosted on Github, so it's not going to be easy to reproduce in Xcode unless you can do this.
Here is the Swift Package definition:
Package.swift.zip
The warnings in the image from the issue when I created it (so first post) are from our SDK which uses the SPM, but I really can't create an Xcode project for this demo, as it is too big to cut down to a demo and without the Github hosted SPM, then it's not an accurate reproduction anyway.
My impression is that it's being caused by SKIE having a cache folder including swift-module-cache which then gets built into the XCFramework when you use "isStatic = true" and hence the warnings with a path to this swift-module-cache.
Screenshot 2024-05-08 at 10 20 14

@FilipDolnik
Copy link
Member

Hello! Can you please send us the full warning message from Xcode? It may contain something that will help us fix the issue even without a reproducer.

My impression is that it's being caused by SKIE having a cache folder including swift-module-cache which then gets built into the XCFramework when you use "isStatic = true" and hence the warnings with a path to this swift-module-cache.

The swift-module-cache is not built into the XCFramework, it's only used for building it. It contains Swift caches for modules on which the built framework depends. The whole skie directory contains only temporary files used during the compilation. The XCFramework and its content is usually located in build/bin/...:
image

@meavydev
Copy link
Author

meavydev commented Jun 3, 2024

OK here is the section from the build output where the warnings appear:
`
Showing All Messages
GenerateDSYMFile /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework.dSYM /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework/navenioSDK (in target 'navenioSDK' from project 'navenioSDK')
cd /Users/shawn/ios/navenioSDK
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework/navenioSDK -o /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework.dSYM

warning: /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/IlsLibrary-22FZ41XVM8TOK.pcm: No such file or directory
note: while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/IlsLibrary-22FZ41XVM8TOK.pcm
note: Linking a static library that was built with -gmodules, but the module cache was not found. Redistributable static libraries should never be built with module debugging enabled. The debug experience will be degraded due to incomplete debug information.
warning: /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/ObjectiveC-NOWQ50CYMZB0.pcm: No such file or directory
note: while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/ObjectiveC-NOWQ50CYMZB0.pcm
warning: /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/Foundation-213A4VPDZWIP8.pcm: No such file or directory
note: while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/Foundation-213A4VPDZWIP8.pcm
warning: /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/_SwiftConcurrencyShims-VUGHILSV67V7.pcm: No such file or directory
note: while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/_SwiftConcurrencyShims-VUGHILSV67V7.pcm

/Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/IlsLibrary-22FZ41XVM8TOK.pcm: No such file or directory

while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/IlsLibrary-22FZ41XVM8TOK.pcm

Linking a static library that was built with -gmodules, but the module cache was not found. Redistributable static libraries should never be built with module debugging enabled. The debug experience will be degraded due to incomplete debug information.

/Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/ObjectiveC-NOWQ50CYMZB0.pcm: No such file or directory

while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/ObjectiveC-NOWQ50CYMZB0.pcm

/Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/Foundation-213A4VPDZWIP8.pcm: No such file or directory

while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/Foundation-213A4VPDZWIP8.pcm

/Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/_SwiftConcurrencyShims-VUGHILSV67V7.pcm: No such file or directory

while processing /Users/shawn/android/libraries/ils/build/skie/binaries/releaseFramework/RELEASE/iosArm64/cache/swift-module-cache/36S9UIVCV1XJ3/_SwiftConcurrencyShims-VUGHILSV67V7.pcm

WriteAuxiliaryFile /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/navenioSDK.build/Debug-iphoneos/navenioSDK.build/Objects-normal/arm64/navenioSDK.SwiftConstValuesFileList (in target 'navenioSDK' from project 'navenioSDK')
cd /Users/shawn/ios/navenioSDK
write-file /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/navenioSDK.build/Debug-iphoneos/navenioSDK.build/Objects-normal/arm64/navenioSDK.SwiftConstValuesFileList

ExtractAppIntentsMetadata (in target 'navenioSDK' from project 'navenioSDK')
cd /Users/shawn/ios/navenioSDK
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/appintentsmetadataprocessor --output /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework --toolchain-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain --module-name navenioSDK --sdk-root /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk --xcode-version 15F31d --platform-family iOS --deployment-target 16.4 --target-triple arm64-apple-ios16.4 --binary-file /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework/navenioSDK --dependency-file /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/navenioSDK.build/Debug-iphoneos/navenioSDK.build/Objects-normal/arm64/navenioSDK_dependency_info.dat --stringsdata-file /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/navenioSDK.build/Debug-iphoneos/navenioSDK.build/Objects-normal/arm64/ExtractedAppShortcutsMetadata.stringsdata --source-file-list /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/navenioSDK.build/Debug-iphoneos/navenioSDK.build/Objects-normal/arm64/navenioSDK.SwiftFileList --swift-const-vals-list /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/navenioSDK.build/Debug-iphoneos/navenioSDK.build/Objects-normal/arm64/navenioSDK.SwiftConstValuesFileList --compile-time-extraction --deployment-aware-processing

note: Metadata extraction skipped. No AppIntents.framework dependency found. (in target 'navenioSDK' from project 'navenioSDK')

Metadata extraction skipped. No AppIntents.framework dependency found.

AppIntentsSSUTraining (in target 'navenioSDK' from project 'navenioSDK')
cd /Users/shawn/ios/navenioSDK
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/appintentsnltrainingprocessor --infoplist-path /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework/Info.plist --temp-dir-path /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/navenioSDK.build/Debug-iphoneos/navenioSDK.build/ssu --bundle-id navenio.sdk --product-path /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework --extracted-metadata-path /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework/Metadata.appintents --archive-ssu-assets

2024-06-03 12:26:28.994 appintentsnltrainingprocessor[59607:2852506] Parsing options for appintentsnltrainingprocessor
2024-06-03 12:26:29.000 appintentsnltrainingprocessor[59607:2852506] No AppShortcuts found - Skipping.

GenerateTAPI /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphoneos/navenioSDK.framework/navenioSDK.tbd (in target 'navenioSDK' from project 'navenioSDK')
cd /Users/shawn/ios/navenioSDK
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/tapi stubify -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/PackageFrameworks -F/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos -F/Users/shawn/ios/navenioSDK -L/Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework/navenioSDK -o /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphoneos/navenioSDK.framework/navenioSDK.tbd

RegisterExecutionPolicyException /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework (in target 'navenioSDK' from project 'navenioSDK')
cd /Users/shawn/ios/navenioSDK
builtin-RegisterExecutionPolicyException /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework

Touch /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework (in target 'navenioSDK' from project 'navenioSDK')
cd /Users/shawn/ios/navenioSDK
/usr/bin/touch -c /Users/shawn/Library/Developer/Xcode/DerivedData/ils-akywhclrfityrwbvnailqcfzkpkk/Build/Products/Debug-iphoneos/navenioSDK.framework

`

@FilipDolnik
Copy link
Member

Fixed in 0.8.2, but you will need to add the following Gradle configuration:

skie {
    build {
        produceDistributableFramework()
    }
}

@meavydev
Copy link
Author

meavydev commented Jun 6, 2024

Thanks :) That seems to have removed the warnings for our SPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants