livekit / client-sdk-swift

LiveKit Swift Client SDK. Easily build live audio or video experiences into your mobile app, game or website.
https://livekit.io
Apache License 2.0
174 stars 84 forks source link

When the Livekit SDK is included as a dependency in another framework, the framework fails to build. #337

Open indaos opened 4 months ago

indaos commented 4 months ago

Describe the bug While attempting to build an XCframework with LiveKit SDK as a dependency, I encountered the following errors.

/Users/daos/Library/Developer/Xcode/DerivedData/UnbluMobileSDK-bhhgojhqukhuwwegpvpuskbnsguw/Build/Intermediates.noindex/LiveKit.build/Release-iphoneos/LiveKit.build/Objects-normal/arm64/LiveKit.swiftinterface:5:8: error: no such module 'CHeaders'
import CHeaders
       ^
/Users/daos/Library/Developer/Xcode/DerivedData/UnbluMobileSDK-bhhgojhqukhuwwegpvpuskbnsguw/Build/Intermediates.noindex/LiveKit.build/Release-iphoneos/LiveKit.build/Objects-normal/arm64/LiveKit.swiftinterface:1:1: error: failed to verify module interface of 'LiveKit' due to the errors above; the textual interface may be broken by project issues or a compiler bug

SDK Version 2.0.1

iOS/macOS Version XCode 15.1

hiroshihorie commented 4 months ago

I can't reproduce this using Xcode 15.2. Did it work for you with v1 ? I checked the diff but there was no changes for CHeaders from v1 -> v2.

indaos commented 4 months ago

I built my own XCFramework (not an app), which has a dependency on Livekit via SPM. Did you do the same? Because such errors are quite common in this specific case.

indaos commented 4 months ago

I just tried version 2.0.2 with 15.2, and the error still exists. Usually, it has nothing to do with "CHeaders" (or similar) itself but rather with the presence of "import CHeaders" in the "swiftinterface" file.

hiroshihorie commented 4 months ago

I'll retry this, thanks for the report.

indaos commented 4 months ago

There are no problems with Xcode 14.2 and version 2, but with version 15, issues arise, not just with CHeaders. When I added @_implementationOnly to import CHeaders just for checking purposes, other errors related to different issues appeared.

hiroshihorie commented 4 months ago

Can you create a minimal reproducible project and attach it here ?

indaos commented 4 months ago

LiveKitTest.zip Hi! use local_build.sh in the project directory

hiroshihorie commented 3 months ago

@indaos Can you try building using this branch ? https://github.com/livekit/client-sdk-swift/pull/356

indaos commented 3 months ago

things have changed, but I got the following errors:

image
hiroshihorie commented 2 months ago

I can build frameworks depending on LiveKit, can you try again with v2.0.6 ?

indaos commented 2 months ago

Have you seen the related issue I posted recently https://github.com/livekit/client-sdk-swift/issues/364#issue-2240095214 I still have the same thing. please explain in more detail how you did this, maybe I missed something...