From 90a152a2bc4355dcf8d7833afcbdc462c3677090 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Thu, 23 May 2024 10:44:06 +0200 Subject: [PATCH] Swift: add flags and instructions for building on macOS ARM --- .bazelrc | 3 ++- swift/README.md | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index c2b4d3b7f03..ca2bb8caee4 100644 --- a/.bazelrc +++ b/.bazelrc @@ -11,7 +11,8 @@ common --override_module=semmle_code=%workspace%/misc/bazel/semmle_code_stub build --repo_env=CC=clang --repo_env=CXX=clang++ build:linux --cxxopt=-std=c++20 -build:macos --cxxopt=-std=c++20 --cpu=darwin_x86_64 +# we currently cannot built the swift extractor for ARM +build:macos --cxxopt=-std=c++20 --copt=-arch --copt=x86_64 --linkopt=-arch --linkopt=x86_64 build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor # this requires developer mode, but is required to have pack installer functioning diff --git a/swift/README.md b/swift/README.md index a2ac9fca380..79621d0b9ef 100644 --- a/swift/README.md +++ b/swift/README.md @@ -16,7 +16,14 @@ brew install bazelisk then from the `ql` directory run ```bash -bazel run //swift:create-extractor-pack # --cpu=darwin_x86_64 # Uncomment on Arm-based Macs +bazel run //swift:create-extractor-pack +``` + +If you are running on macOS and you encounter errors mentioning `XXX is unavailable: introduced in macOS YY.ZZ`, +you will need to run this from the root of your `codeql` checkout: + +```bash +echo common --macos_sdk_version=$(sw_vers --productVersion) >> local.bazelrc ``` which will install `swift/extractor-pack`.