codeql-action icon indicating copy to clipboard operation
codeql-action copied to clipboard

XCode iOS builds fail after using AdvancedSecurityCodeqlInit task

Open geertbleyen opened this issue 2 years ago • 3 comments

Environment

Version of codeql-action: v2.14.6 Programming Language: Swift Self-Hosting agent platform: MacOS 13.5.2 Build Target platform: iOS 16.2 Using Azude Devops Services

Issue

After using the AdvancedSecurityCodeqlInit task in our pipeline, the subsequent task which builds our application for iOS (Using the xcode task in Azure Devops) no longer builds correctly. From what I gather from the logs, after running the task AdvancedSecurityCodeqlInit, xcode no longer builds the correct platform and uses the wrong SDK and fails (uses MacOS platform and SDK, instead of iOS) Running the same xcodebuild commandline from the terminal yields a successful build. Running the same pipeline with the AdvancedSecurityCodeql tasks removed also yield a successful build.

Logs

AdvancedSecurityCodeqlInit.log xcodebuild.log

geertbleyen avatar Sep 22 '23 09:09 geertbleyen

Hi @geertbleyen, looking at the logs it seems that the build is actually correct (modulo that it fails 😅): the macOS part is building Swift package descriptions. What fails is some weird mismatch between Swift toolchains while building those packages, e.g.:

// Slightly reformatted for readability
/Users/svcp_adsagtmotion/azagents/A1-mac/_work/2/s/Packages/SpeechRecognition/Package.swift:1:8: error: failed to build module 'Foundation'; 
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.9 (swiftlang-5.9.0.123.203 clang-1500.0.37.1)',
while this compiler is 'Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)').
Please select a toolchain which matches the SDK.

CodeQL doesn't support Swift 5.9 yet so I'm not sure where the toolchain discrepancy is coming from.

AlexDenisov avatar Sep 22 '23 12:09 AlexDenisov

We are using XCode 15 RTM (forgot to mention in the environment info), which does use Swift 5.9 by default. I understand what you mean with the MacOS platform/sdk bit, so yeah, it's not the crosscompile issue I presumed it would be. But I also don't know where these 2 different swift 5.9 toolchains would be coming from.

geertbleyen avatar Sep 22 '23 12:09 geertbleyen