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

Xcode 14.3 RC 2 (14E222b)/Swift Compiler 5.8 SwiftVerifyEmittedModuleInterface failed to verify module interface #64669

Closed
Fushj89 opened this issue Mar 28, 2023 · 26 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself disambiguation Bug: disambiguation duplicate Resolution: Duplicates another issue swift 5.9 textual interfaces type checker Area → compiler: Semantic analysis TypeResolver types Feature: types unexpected error Bug: Unexpected error

Comments

@Fushj89
Copy link
Contributor

Fushj89 commented Mar 28, 2023

Description

Use Xcode 14.3 RC 2 compile a swift file which import a objc clang module, and a framework with swiftinterface, verify module interface happened error. The clang module path is explicitly passed by -fmodule-map-file.

Steps to reproduce
1、download SwiftVerifyInterfaceIssue.zip and unzip
2、Use Xcode 14.3 RC 2 open SwiftVerifyInterfaceIssue.xcworkspace, and then build

Expected behavior
build success

image

Environment

  • Swift compiler version info swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
  • Xcode version info Xcode 14.3 Build version 14E222b

SwiftVerifyInterfaceIssue.zip

@Fushj89 Fushj89 added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 28, 2023
@Fushj89 Fushj89 changed the title Xcode 14.3 RC 2 (14E222b) verify module interface failed Xcode 14.3 RC 2 (14E222b)/Swift Compiler 5.8 verify module interface failed Mar 28, 2023
@Fushj89 Fushj89 changed the title Xcode 14.3 RC 2 (14E222b)/Swift Compiler 5.8 verify module interface failed Xcode 14.3 RC 2 (14E222b)/Swift Compiler 5.8 SwiftVerifyEmittedModuleInterface failed Mar 28, 2023
@Fushj89 Fushj89 changed the title Xcode 14.3 RC 2 (14E222b)/Swift Compiler 5.8 SwiftVerifyEmittedModuleInterface failed Xcode 14.3 RC 2 (14E222b)/Swift Compiler 5.8 SwiftVerifyEmittedModuleInterface failed to verify module interface Mar 29, 2023
@CrazyFanFan
Copy link
Contributor

You can try change the default behavior of the Swift compiler by passing -no-verify-emitter-module-interface to OTHER_SWIFT_FLAGS

@Fushj89
Copy link
Contributor Author

Fushj89 commented Mar 30, 2023

@CrazyFanFan thank you very much, it works.

@HaleXie
Copy link

HaleXie commented Mar 31, 2023

-no-verify-emitted-module-interface

@super-gsevla
Copy link

super-gsevla commented Apr 2, 2023

I'm having the exact same issue but with an other module. Where should I put the -no-verify-emitted-module-interface flag? I have tried to add it at the end of Other Swift Flags placed on Xcode Build Settings but it seems to have no effect.

I'm using Xcode 14.3(14E222b) by the way.

edit
Already tried to add the flag above the -fmodule-map-file flag.

Being more specific, this issue is happening with BlueCryptor module.
Captura de Tela 2023-04-02 às 13 37 14
Captura de Tela 2023-04-02 às 13 38 31

@thanhtanh
Copy link

For my side, adding no-verify-emitter-module-interface (without the first -) to OTHER_SWIFT_FLAGS works

@CrazyFanFan
Copy link
Contributor

I'm having the exact same issue but with an other module. Where should I put the -no-verify-emitted-module-interface flag? I have tried to add it at the end of Other Swift Flags placed on Xcode Build Settings but it seems to have no effect.

I'm using Xcode 14.3(14E222b) by the way.

edit Already tried to add the flag above the -fmodule-map-file flag.

Being more specific, this issue is happening with BlueCryptor module. Captura de Tela 2023-04-02 às 13 37 14 Captura de Tela 2023-04-02 às 13 38 31

Are you using Cocoapods as a package management tool? If so, please try "--clean-install".

@Fushj89
Copy link
Contributor Author

Fushj89 commented Apr 3, 2023

@super-gsevla put the -no-verify-emitted-module-interface flag on the faild target.
e.g the SwiftPodA compile failed because of verify module interface, then put -no-verify-emitted-module-interface on the SwiftPodA target.
image

if you use CocoaPods, you can add
s.xcconfig = { 'OTHER_SWIFT_FLAGS' => '-no-verify-emitted-module-interface' } to the SwiftPodA.podspec

@super-gsevla
Copy link

Hey! Sorry about the delay.

We have solved it here by setting only active arch to "no" into cocoapods build_settings post_install hook.

@AnthonyLatsis
Copy link
Collaborator

@xymus Does this look like a compiler bug to you?

@cdhoffmann
Copy link

The workarounds are working for us but we would like to know if this is intended behavior as of Xcode 14.3, or if this is a bug. We created the following radar under our team.

@xymus
Copy link
Contributor

xymus commented Apr 12, 2023

This is a known compiler limitation, it doesn't handle well the ambiguity when a type has the same name as a module. It can break the generated swiftinterfaces. Here you see it reported by the swiftinterface verification, but it would likely also break clients of the module when they use a different Xcode or compiler version.

If you see an error like ObjcPod is not a member type of class ObjcPod.ObjcPod with the repeated names, instead of disabling the verification you may be able to fix the swiftinterface by adding the following flags to the Other Swift Flags build setting of the target building the module with the error: -Xfrontend -module-interface-preserve-types-as-written

@CrazyFanFan
Copy link
Contributor

CrazyFanFan commented Apr 20, 2023

@xymus Thank you for your reply, in my project -xfrontend -module-interface-preserve-types-as-writte not work when SWIFT_INSTALL_OBJC_HEADER=NO

Attached is a demo project.
SwiftInterfaceVerifyFailedDemo.zip

@AnthonyLatsis AnthonyLatsis added type checker Area → compiler: Semantic analysis TypeResolver unexpected error Bug: Unexpected error types Feature: types disambiguation Bug: disambiguation and removed textual interfaces triage needed This issue needs more specific labels labels Apr 21, 2023
@AnthonyLatsis
Copy link
Collaborator

Reduced:

// module 'test'

struct test {}
func foo(_: test.test) {} // error: 'test' is not a member type of struct 'test.test'

@pczhu
Copy link

pczhu commented Apr 21, 2023

None of the solutions worked for me.

@rashadatjou
Copy link

As mentioned above, the error is triggered by a dependency. Experiencing the same issue when archiving a framework using the BUILD_LIBRARY_FOR_DISTRIBUTION=YES option. Unfortunately no solution works currently.

Xcode: 14.3
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0

tkrajacic added a commit to stairtree/StructuredWebSocketClient that referenced this issue May 25, 2023
This works around a problem of having a type and module share the same name. Xcode 14.3 doesn't like it in textual swiftinterface files, and in xcodebuild the interface verification would fail.

See swiftlang/swift#64669
tkrajacic added a commit to stairtree/StructuredWebSocketClient that referenced this issue May 25, 2023
This works around a problem of having a type and module share the same name. Xcode 14.3 doesn't like it in textual swiftinterface files, and in xcodebuild the interface verification would fail.

See swiftlang/swift#64669
@bimawa
Copy link

bimawa commented Jun 7, 2023

Looks like xcode 14.3 useless for us now.. and should we downgrade to 14.2?

@xymus
Copy link
Contributor

xymus commented Jun 7, 2023

What's new in recent Xcodes is that we report this issue whereas older Xcodes would not detect it, which lead to delayed failures.

For the time being, my advice is to try the workarounds I suggested above first. In last resort you can disable the verification with -no-verify-emitted-module-interface to get the same behavior as older Xcodes.

@bimawa
Copy link

bimawa commented Jun 11, 2023

What's new in recent Xcodes is that we report this issue whereas older Xcodes would not detect it, which lead to delayed failures.

For the time being, my advice is to try the workarounds I suggested above first. In last resort you can disable the verification with -no-verify-emitted-module-interface to get the same behavior as older Xcodes.

Should we use unsafe flags for SPM?
If yes, we can meet with:

As the usage of the word “unsafe” implies, Swift Package Manager can’t safely determine if the build flags have any negative side effect on the build since certain flags can change the behavior of how it performs a build.

As some build flags can be exploited for unsupported or malicious behavior, the use of unsafe flags makes the products containing this target ineligible for use by other packages.

We are making a framework spm, and our clients should be sure about safe code and ABI support.
How can we workaround it?

The whole community started renaming all packages. Maybe we should just a wait?

@bimawa
Copy link

bimawa commented Jun 11, 2023

Related issue: #56573

@bimawa
Copy link

bimawa commented Jul 14, 2023

UPD:
Ok I build it for spm:

  1. I created Release.xcconfig
  2. added one line: OTHER_SWIFT_FLAGS = -no-verify-emitted-module-interface
  3. added this file to config as param for xcodebuild
xcodebuild archive -scheme schemeName \                                                                                                                                                 
	 -disableAutomaticPackageResolution \
	 -destination "generic/platform=iOS" \
	 -archivePath Release-iphoneos \
	 -configuration Release \
	 -derivedDataPath ".build" \
	 -xcconfig Release.xcconfig \
	 -UseModernBuildSystem=YES \
	 SKIP_INSTALL=NO \
	 BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
	 DEPLOYMENT_POSTPROCESSING=YES \
	 STRIP_INSTALLED_PRODUCT=YES \
	 SWIFT_INSTALL_OBJC_HEADER=YES \
	 GENERATE_MASTER_OBJECT_FILE=NO \
	 STRIP_STYLE=non-global
  1. profit

@xymus Thanks, for your useful advice!

@AnthonyLatsis
Copy link
Collaborator

Duplicate of #56573

@mohdmunaf
Copy link

The solution of adding -no-verify-emitted-module-interface worked for running on simulator. Fails to run on a real device.

Enricoza added a commit to Tealium/tealium-ios-appsflyer-remote-command that referenced this issue Mar 15, 2024
Enricoza added a commit to Tealium/tealium-ios-appsflyer-remote-command that referenced this issue Mar 15, 2024
* Remove TealiumRegistration and notification handling in favour of onReady

* Make sure that every onReady publishes old registered callbacks in case it detects a manual initialization

* Test and fix onReady calls and initialize

Remove initialize background queue dispatch as it is already happening on that queue

* Update Carthage/SPM and add publish/build scripts

* Remove comment

* Avoid issues when build the framework due to AppsFlyerLib framework having a class named AppsFlyerLib

swiftlang/swift#64669 (comment)
janvv added a commit to janvv/GarminService that referenced this issue Jul 26, 2024
…olution support, remove obsolete copyrights.

* Adding ConnectIQ as package dependency failed loading, unclear why.
* Library evolution support must be disabled, otherwise compiler error (see swiftlang/swift#64669 (comment))
ShoYamanishi added a commit to ShoYamanishi/SDFontApple that referenced this issue Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself disambiguation Bug: disambiguation duplicate Resolution: Duplicates another issue swift 5.9 textual interfaces type checker Area → compiler: Semantic analysis TypeResolver types Feature: types unexpected error Bug: Unexpected error
Projects
None yet
Development

No branches or pull requests