From bd301928ad9a9683d6b91d4d3804fc01722c30e2 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Thu, 8 Jun 2023 12:39:16 -0400 Subject: [PATCH 1/3] try to explicitly restrict stdinc paths on macos --- .bazelrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.bazelrc b/.bazelrc index c47472bdad..56bc13880b 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,11 @@ +# Exclude all system include directories on macOS. +# TODO: Use {compiler_version} variable. +build:macos --copt=-nostdinc +build:macos --copt=-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include +build:macos --copt=-isystem/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include +build:macos --copt=-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include +build:macos --copt=-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.3/include + # Enable configurations specific to the host platform. common --enable_platform_specific_config From 6f8078152997d48a2a92d135b862236ca174bacd Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Thu, 8 Jun 2023 14:53:56 -0400 Subject: [PATCH 2/3] patch `curl`; working build --- WORKSPACE.bazel | 2 ++ bazel/third_party/curl/7.85.0.patch | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 bazel/third_party/curl/7.85.0.patch diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index 52b44d3ba8..b1689ebb5d 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -148,6 +148,8 @@ versioned_http_file( versioned_http_archive( name = "curl", build_file = "//bazel/third_party/curl:curl.BUILD", + patch_args = ["-p1"], + patches = ["//bazel/third_party/curl:{version}.patch"], sha256 = "78a06f918bd5fde3c4573ef4f9806f56372b32ec1829c9ec474799eeee641c27", strip_prefix = "curl-{version}", url = "https://curl.se/download/curl-{version}.tar.gz", diff --git a/bazel/third_party/curl/7.85.0.patch b/bazel/third_party/curl/7.85.0.patch new file mode 100644 index 0000000000..ead22bc1c5 --- /dev/null +++ b/bazel/third_party/curl/7.85.0.patch @@ -0,0 +1,13 @@ +diff --git a/lib/easy_lock.h b/lib/easy_lock.h +index d96e56b8d..313baf32f 100644 +--- a/lib/easy_lock.h ++++ b/lib/easy_lock.h +@@ -23,6 +23,8 @@ + ***************************************************************************/ + + #include "curl_setup.h" ++#undef HAVE_ATOMIC ++#undef HAVE_STDATOMIC_H + + #define GLOBAL_INIT_IS_THREADSAFE + From 7d11fa22b118d33c1a1e30cc212123e8647cb3db Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Fri, 9 Jun 2023 11:27:56 -0400 Subject: [PATCH 3/3] build: make `curl` patch `macos-aarch64`-specific --- bazel/third_party/curl/7.85.0.patch | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bazel/third_party/curl/7.85.0.patch b/bazel/third_party/curl/7.85.0.patch index ead22bc1c5..2a7500cc35 100644 --- a/bazel/third_party/curl/7.85.0.patch +++ b/bazel/third_party/curl/7.85.0.patch @@ -1,13 +1,16 @@ diff --git a/lib/easy_lock.h b/lib/easy_lock.h -index d96e56b8d..313baf32f 100644 +index d96e56b8d..92e963240 100644 --- a/lib/easy_lock.h +++ b/lib/easy_lock.h -@@ -23,6 +23,8 @@ - ***************************************************************************/ +@@ -24,6 +24,11 @@ #include "curl_setup.h" + ++#if defined(URBIT_RUNTIME_CPU_AARCH64) && defined(URBIT_RUNTIME_OS_DARWIN) +#undef HAVE_ATOMIC +#undef HAVE_STDATOMIC_H - ++#endif ++ #define GLOBAL_INIT_IS_THREADSAFE + #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600