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

SwiftVerifyEmittedModuleInterface error when compiling RollbarReport with Framework Target #328

Open
rashadatjou opened this issue Jul 27, 2023 · 5 comments
Assignees

Comments

@rashadatjou
Copy link

rashadatjou commented Jul 27, 2023

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:

  1. Add RollbarNotifier as a dependency to a Swift framework project.
  2. Attempt to archive the framework using xcodebuild with the flag BUILD_LIBRARY_FOR_DISTRIBUTION = YES.
  3. Observe the compiler error.

Expected behavior
We expected the framework to compile successfully without errors, even when including RollbarReport as a dependency.

Screenshots
Screenshot 2023-07-27 at 14 15 39

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.

@rashadatjou
Copy link
Author

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

@matux
Copy link
Collaborator

matux commented Aug 2, 2023

@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.

@matux matux self-assigned this Aug 2, 2023
@matux
Copy link
Collaborator

matux commented Aug 2, 2023

@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.

@matux
Copy link
Collaborator

matux commented Aug 2, 2023

@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:

@rollbar-bborsits @mudetroit FYI, there's no further action required here, for now.

@rashadatjou
Copy link
Author

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

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