GoogleCloudPlatform / recaptcha-enterprise-mobile-sdk

Apache License 2.0
29 stars 5 forks source link

Got fatal error: module 'RecaptchaInterop' in AST file is not defined in any loaded module map file #106

Closed AlanLoyc closed 4 months ago

AlanLoyc commented 4 months ago

Describe the issue After upgrading to 18.5.0-beta03 through integration with SPM, I got the following error while compiling and building the app:

No file:0 - fatal error: module 'RecaptchaInterop' in AST file '/Users/ec2-user/Library/Developer/Xcode/DerivedData/MyProj-pbazhlgisxegqoqaiwtfbgsfanqi/ModuleCache.noindex/3ROQMBZEY3WJP/RecaptchaInterop-9FFNWOIC3AE3.pcm' (imported by AST file '/Users/ec2-user/Library/Developer/Xcode/DerivedData/MyProj-pbazhlgisxegqoqaiwtfbgsfanqi/ModuleCache.noindex/3ROQMBZEY3WJP/RecaptchaEnterprise-GQ2OV2LX2BSP.pcm') is not defined in any loaded module map file; maybe you need to load '/Users/ec2-user/Library/Developer/Xcode/DerivedData/MyProj-pbazhlgisxegqoqaiwtfbgsfanqi/Build/Intermediates.noindex/GeneratedModuleMaps-iphonesimulator/RecaptchaInterop.modulemap'?

fatal error: module 'RecaptchaInterop' in AST file '/Users/ec2-user/Library/Developer/Xcode/DerivedData/MyProj-pbazhlgisxegqoqaiwtfbgsfanqi/ModuleCache.noindex/3ROQMBZEY3WJP/RecaptchaInterop-9FFNWOIC3AE3.pcm' (imported by AST file '/Users/ec2-user/Library/Developer/Xcode/DerivedData/MyProj-pbazhlgisxegqoqaiwtfbgsfanqi/ModuleCache.noindex/3ROQMBZEY3WJP/RecaptchaEnterprise-GQ2OV2LX2BSP.pcm') is not defined in any loaded module map file; maybe you need to load '/Users/ec2-user/Library/Developer/Xcode/DerivedData/MyProj-pbazhlgisxegqoqaiwtfbgsfanqi/Build/Intermediates.noindex/GeneratedModuleMaps-iphonesimulator/RecaptchaInterop.modulemap'?

Though the build and export completed successfully and it looks like the app functions normally as well, this error is not seen when using previous versions, is this something that should be looked into?

Thank you in advance!

Integration Method

SDK Version (e.g. 18.0.1): 18.5.0-beta03, 18.5.0-beta04

To Reproduce Steps to reproduce the behavior:

  1. Upgrade SDK version from 18.1.2 to 18.5.0-beta03
  2. Compile and build app with fastlane gym

Expected behavior App built and exported without error

Xcode version for iOS (please complete the following information): 15.3

Device (please complete the following information): N/A

walterjgsp commented 4 months ago

Thanks for the report @AlanLoyc, could you try to clean the DerivedData to see if it solves the issue, please? In the comments of the following thread there is an example how to do it https://forums.developer.apple.com/forums/thread/26118

AlanLoyc commented 4 months ago

Thanks for the report @AlanLoyc, could you try to clean the DerivedData to see if it solves the issue, please? In the comments of the following thread there is an example how to do it https://forums.developer.apple.com/forums/thread/26118

Thank you @walterjgsp! I have tried removing all the contents in the DerivedData dir and performing cleaning as instructed in the thread, but seems the error still persists.

walterjgsp commented 4 months ago

If you use 18.5.0-beta02 instead of 18.5.0-beta03 you see the same problem? I've just tested with 18.5.0-beta03 and 18.5.0-beta04 and when archiving I'm not seeing any of those errors. Do you have a small project reproducing the error that you can share with us?

AlanLoyc commented 4 months ago

If you use 18.5.0-beta02 instead of 18.5.0-beta03 you see the same problem? I've just tested with 18.5.0-beta03 and 18.5.0-beta04 and when archiving I'm not seeing any of those errors. Do you have a small project reproducing the error that you can share with us?

I have managed to reproduce the issue with a test project here: https://github.com/AlanLoyc/RecaptchaTroubleshoot

During setting it up I think I might have found the cause of the error - the import statement in the bridging header file (https://github.com/AlanLoyc/RecaptchaTroubleshoot/blob/main/RecaptchaTroubleshoot/RecaptchaTroubleshoot/Troubleshoot-Bridging-Header.h).

To reproduce the error:

  1. Download, open the project and build
  2. The project should build successfully without any error, however we found that the error is not shown by Xcode, you will have to export the build log to see it
  3. Navigate to the Report tab in Xcode and find the build process
  4. Export the build log through the Export... button photo_2024-05-02_17-50-46
  5. Open the build log file and search for "fatal" photo_2024-05-02_17-50-51

If I comment the RecaptchaEnterprise import statement the error will be gone. However, the import statement as well as the bridging header is instructed by the integration documentation (by this step) when the SPM option was not available. We have also tried build without the import statement and it seems it worked fine as well. Can we confirm it is no longer needed?

walterjgsp commented 4 months ago

Thanks for doing the investigation @AlanLoyc. We will do some investigations from our side to understand what's happening there but could be that now using SPM is not necessary to have the bridge header anymore and maybe also for Cocoapods. I will keep you posted.

walterjgsp commented 4 months ago

Hi @AlanLoyc, I've tested the project with recaptcha versions from 18.3.0 to 18.5.0-beta04 in Xcode 15.3 and is just like you pointed. With the header the fatal warning will appear when you export the build log. I removed the header all together and retested on those versions in Xcode 15.3 and everything worked.

To do another test I switched to Xcode 15.1 using the reCaptcha iOS 18.4.0 and reCaptcha iOS 18.5.0-beta02 (that's the maximum version that I can use on this Xcode) and in those versions the moment that I've tried to build without the bridge header it broke. After some debugging and error investigation I removed the Package.resolved file that's hidden. In this setup everything started to work again without the bridge header. When I added the bridge header it kept on working and the fatal error when building did not appear.

I imagine that this is something new to Xcode 15.3 but it seems that the bridge header is not necessary anymore. Since Xcode 15.3 has a lot of know bugs in the build phase I will hold removing the header to the documentation until we have a clear understanding of what's going on.

Thanks a lot for the report!

AlanLoyc commented 4 months ago

Thank you very much for the testing and the update @walterjgsp! That looks good to me as well and in the meantime I will close the issue first as the error has been resolved.