rollbar-apple
rollbar-apple copied to clipboard
SwiftVerifyEmittedModuleInterface error when compiling `RollbarReport` with Framework Target
Describe the bug
After resolving the issue with Rollbar-Apple SDK, we are now encountering a similar problem with another part of the library called RollbarReport
. When trying to compile the framework with RollbarReport
as a dependency, the .swiftinterface
file is broken, leading to a compile-time error. The issue appears to be related to the RollbarCrash
module, which contains files with the same name, specifically RollbarCrash.h
and RollbarCrash.m
. This naming conflict might be the reason why RollbarReport
is failing to be compiled with a framework target.
To Reproduce Steps to reproduce the behavior:
- Add
RollbarNotifier
as a dependency to a Swift framework project. - Attempt to archive the framework using
xcodebuild
with the flagBUILD_LIBRARY_FOR_DISTRIBUTION = YES
. - Observe the compiler error.
Expected behavior
We expected the framework to compile successfully without errors, even when including RollbarReport
as a dependency.
Screenshots
Rollbar-Apple SDK version: 3.1.0
Calling the SDK from (x-mark all suitable): [] Objective-C [X] Swift [] Other:
Runtime environment (please complete the following information as applicable):
Xcode Versions Used: 14.3.1
Swift Version Used: 5.8
Additional context
This issue arose after resolving a similar problem with Rollbar-Apple SDK. We suspect that the naming conflict in the RollbarCrash
module might be causing the issue with RollbarReport
. Any insights or solutions to address this problem would be greatly appreciated.
The issue is tied to the RollbarReport module itself. The RollbarCrash classes are not at fault here to corect myself. This isssue is happening with version 3.1.0
@rashadatjou Hey! I appreciate you taking the time to report this issue, I'm looking into this right now. In the meantime, could you try archiving through Xcode and check if it works?
I'm gonna take care of the module/class name conflict, asap.
@rashadatjou I've created the nameconflict
branch where I removed the conflict. Unfortunately, it still doesn't seem to be working when compiling via xcodebuild
with BUILD_LIBRARY_FOR_DISTRIBUTION=YES
.
However, Xcode is able to build and archive fine with this option enabled.
I'm using the Example/Integration/SPMFramework
project to check this.
You're welcome to have a look, I'm gonna keep trying to get this working.
@rashadatjou The error being reported
RollbarReport.swiftinterface:7:8: error: no such module 'RollbarCrash'
import RollbarCrash
^
Points at the module not being included in whatever SwiftVerifyEmittedModuleInterface
does to perform the verification. As far as I can tell, there are no linkage issues when importing the emitted library/framework that in turn imports RollbarNotifer
on a separate application project. Subsequently having the framework trigger a crash or log a message using the Rollbar SDK seems to work fine as far as I can tell.
While researching this issue, there seem to be a fair amount of people having issues with this and, apart from the known same-Module/Type name collision bug, there seem to be other issues, especially when dealing with mixed libraries.
This is the xcodebuild
command I'm using to build the SPMFramework workspace which includes Rollbar, the Framework importing Rollbar and an Application that imports said Framework:
xcodebuild archive \
-workspace SPMFramework.xcworkspace \
-scheme SPMFramework \
-derivedDataPath "build" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
OTHER_SWIFT_FLAGS="$(inherited) -no-verify-emitted-module-interface"
Note OTHER_SWIFT_FLAGS="$(inherited) -no-verify-emitted-module-interface"
which is basically telling xcodebuild
not to verify the emitted .swiftinterface
and thus, the workspace builds.
It's also important to note, this was the default behavior on Xcode 14.2 and below.
I hope this doesn't give you trouble after turning off the swiftinterface
verification step, and if it does, please tell me, and we'll look for a solution! I'll leave this issue open for you to respond.
References:
- https://github.com/apple/swift/issues/64669
- https://stackoverflow.com/questions/75903232/xcode-14-3-no-such-module-objc
- https://forums.swift.org/t/swiftinterface-no-such-module-in-xcframework/57484/2
- https://forums.swift.org/t/update-on-implementation-only-imports/26996
- https://forums.swift.org/t/distribute-xcframework-with-mixed-implementation-only-and-exported-dependencies/57863
@rollbar-bborsits @mudetroit FYI, there's no further action required here, for now.
I have tried the above mentioned fix a while ago but unfortunately the .swiftinterface file is really broken it is not a false alarm from the compiler. The RollbarCrash module is broken and this might cause you guys issue with Xcode 15 as well.
I have looked into RollbarCrash and one thing that stood out is the module.modulemap
does not expose an umbrella header
for some reason?
Also you can read more about the module verifier in xcode here: https://developer.apple.com/documentation/xcode/identifying-and-addressing-framework-module-issues
You can trigger the error using the command bellow (so you don't need to embed into a xcframework to test it out). Make sure that you are executing this command inside of RollbarNotifier:
swift build -c release -Xswiftc -emit-module-interface -Xswiftc -enable-library-evolution