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

BUILD_LIBRARY_FOR_DISTRIBUTION causes Build failure for EudiWalletKit integration in Dynamic Library #117

Open
kimera84 opened this issue Nov 6, 2024 · 8 comments

Comments

@kimera84
Copy link

kimera84 commented Nov 6, 2024

Hello,

I'm encountering an issue when integrating EudiWalletKit (v0.6.9) into an Xcode project that needs to be distributed as an XCFramework.

My project setup:

Xcode Version: 16
Project Type: Dynamic library (intended to be built and distributed as an XCFramework)
Integration Method: Swift Package Manager (SPM) dependency for EudiWalletKit
Problem
When I set BUILD_LIBRARY_FOR_DISTRIBUTION to YES in my project, the build fails with the following error:

SwiftVerifyEmittedModuleInterface normal arm64 Verifying emitted module interface WalletSDK.swiftinterface

After setting BUILD_LIBRARY_FOR_DISTRIBUTION to NO, the build succeeds, but this is not an ideal solution as I need to ensure binary compatibility for the distributed XCFramework.

@kimera84
Copy link
Author

kimera84 commented Nov 7, 2024

Could you advise on an alternative integration method that allows incorporating EudiWalletKit without using Swift Package Manager (SPM)? Our goal is to ensure that the source code of our SDK remains convenient for our clients while keeping EudiWalletKit fully functional (on our sdk).

@phisakel
Copy link
Collaborator

@kimera84 I have found a solution in stack overflow here

@kimera84
Copy link
Author

Thank you very much for your response, @phisakel.
I have already tried that solution, and it seems to work for other SPMs.

However, when I include the EUDI SDK in an empty Xcode project with a Framework target and run the following command:

xcodebuild archive \
    -scheme MyFramework \
    -configuration Release \
    -derivedDataPath ".build" \
    -UseModernBuildSystem=YES \
    OTHER_SWIFT_FLAGS="-no-verify-emitted-module-interface" \
    SKIP_INSTALL=NO \
    BUILD_LIBRARY_FOR_DISTRIBUTION=YES

I encounter this error:

The following build commands failed:
SwiftEmitModule normal arm64 Emitting module for _CertificateInternals (in target '_CertificateInternals' from project 'swift-certificates')
SwiftCompile normal arm64 /Users/sergio/Desktop/TestXCFRAMEWORK/.build/SourcePackages/checkouts/swift-certificates/Sources/_CertificateInternals/_TinyArray.swift (in target '_CertificateInternals' from project 'swift-certificates')

This occurs while archiving the project TestXCFRAMEWORK with the scheme MyFramework.
I have also tried setting the flag directly in the Build Settings, but the issue persists.

Thank you very much for your time!

@phisakel
Copy link
Collaborator

@kimera Are you compiling for Swift 6?

@kimera84
Copy link
Author

kimera84 commented Nov 26, 2024

Dear @phisakel, I tried with xCode 15.x / 16.0 with Swift 5/6. I would greatly appreciate it if you could attempt creating an XCFramework of your library yourself or embedding it into another XCFramework just to figure out the feasibility.

Be sure to try with BUILD_LIBRARY_FOR_DISTRIBUTION enabled

Thanks a lot for your time.

@phisakel
Copy link
Collaborator

phisakel commented Nov 28, 2024

@kimera84 I think that the @_implementationOnly attribute will help with the XCFramework issue

@kimera84
Copy link
Author

Screenshot 2024-11-28 at 19 56 01

Thank @phisakel, already tried some time ago with [@_implementationOnly]. Not working.
This is a project I created just as example. No import of the EUDI.

My command

xcodebuild clean build \ -project MyXC.xcodeproj \ -scheme MyXC \ -configuration Release \ -xcconfig Release.xcconfig \ -destination 'platform=iOS Simulator,name=iPhone 16 Pro' \ -derivedDataPath './build' \ -OTHER_SWIFT_FLAGS='-no-verify-emitted-module-interface' \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES

Result

'** BUILD FAILED **

The following build commands failed:
SwiftCompile normal arm64 /Users/sergio/Desktop/MyXC/build/SourcePackages/checkouts/swift-certificates/Sources/_CertificateInternals/_TinyArray.swift (in target '_CertificateInternals' from project 'swift-certificates')
SwiftEmitModule normal arm64 Emitting\ module\ for\ _CertificateInternals (in target '_CertificateInternals' from project 'swift-certificates')
SwiftEmitModule normal arm64 Emitting\ module\ for\ Chronometer (in target 'Chronometer' from project 'Chronometer')
Building project MyXC with scheme MyXC and configuration Release'

@kimera84
Copy link
Author

I understand that this is a sensitive topic, @phisakel.

After my attempts and following this discussion: https://forums.swift.org/t/how-to-build-swift-package-as-xcframework/41414, I am quite convinced that it's actually not possible to encapsulate your SDK within another.

Our goal is to wrap everything and create our own, limiting the visibility of the implementations.
If you have any suggestions regarding this, they would be greatly appreciated.

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

2 participants