July '24 macOS image updates fail when running xcode tests. Duplicate modules defined via having Xcode.app
Description
With the macOS 13 image version 20240714.2, our test workflow started to fail. We also tried the new macOS 14 image versions, i.e. 20240714.2.
The failure arose building when building our tests via
xcodebuild -workspace redacted.xcworkspace -scheme "redacted" -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest,arch=x86_64' -configuration Debug test
and failed with the following command executed by xcodebuild:
The following build commands failed:
SwiftGeneratePch normal x86_64 Compiling\ bridging\ header (in target 'redcated' from project 'redcated')
The error seemingly matched the issue reported here: https://forums.developer.apple.com/forums/thread/739510 Our errors reported were similar:
/Applications/Xcode_15.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/swift/module.modulemap:13:8: error: redefinition of module 'SwiftBridging'
module SwiftBridging {
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/swift/module.modulemap:13:8: note: previously defined here
module SwiftBridging {
There, you can see the duplication of the module between Xcode_15.4.app and Xcode.app. This is just one example, but fails for many modules in the same way. Following the post listed above, we were able to workaround this issue by executing the following command before executing the xcodebuild command:
rm -rf /Applications/Xcode.app
My guess is that the new older images did not have a default Xcode.app defined, and only the version-named instances as listed in the readmes
Platforms affected
- [ ] Azure DevOps
- [X] GitHub Actions - Standard Runners
- [X] GitHub Actions - Larger Runners
Runner images affected
- [ ] Ubuntu 20.04
- [ ] Ubuntu 22.04
- [ ] Ubuntu 24.04
- [ ] macOS 12
- [X] macOS 13
- [X] macOS 13 Arm64
- [X] macOS 14
- [X] macOS 14 Arm64
- [ ] Windows Server 2019
- [ ] Windows Server 2022
Image version and build link
20240714.1
Is it regression?
20240707.2
Expected behavior
Xcode.app does not exist in the image.
Actual behavior
Xcode.app does exist and building for simulator/tests results in a failure for duplicate modules found.
Repro steps
Execute a command similar to the following in actions for building for tests for iOS
xcodebuild -workspace redacted.xcworkspace -scheme "redacted" -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest,arch=x86_64' -configuration Debug test
Hi @jacob-maristany-keeper We will take a look into this issue.Will keep you posted.
Hi @jacob-maristany-keeper We could see that a symlink is created for Xcode.app:
Xcode.app -> /Applications/Xcode_15.2.app ( for macOS13)
Xcode.app -> /Applications/Xcode_15.4.app ( for macOS14)
Could you please retry once and also provide us with a workflow with error incase of failure.
@sureshe456 that simlink is the problem and removing it via command fixed our problem. It doesn't appear that that simlink existed in previous versions of the images.
Hi @jacob-maristany-keeper We could see that the symlink existed in the previous images as well. If we don't set a Xcode version for building the modules then it will work this way so could you please setup required Xcode version as default and then rerun build again and let us know.
Hi @jacob-maristany-keeper As you could see below the Xcode.app is just a symlink to the current default version of Xcode (15.4 incase of macOS-14). Closing the issue for now, please reach out incase of more questions.