diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index 838ac01f..0a28d6cd 100755 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -5,7 +5,7 @@ jobs: - job: osx pool: - vmImage: macOS-12 + vmImage: macos-14 strategy: matrix: osx_64_channel_targetsconda-forge_libcxx_debughardeningdebugsys_abipost-12: diff --git a/.ci_support/linux_64_channel_targetsconda-forge_libcxx_debughardeningdebug.yaml b/.ci_support/linux_64_channel_targetsconda-forge_libcxx_debughardeningdebug.yaml index 8d3b838f..504ab85d 100644 --- a/.ci_support/linux_64_channel_targetsconda-forge_libcxx_debughardeningdebug.yaml +++ b/.ci_support/linux_64_channel_targetsconda-forge_libcxx_debughardeningdebug.yaml @@ -1,7 +1,7 @@ c_compiler: - gcc c_compiler_version: -- '13' +- '14' c_stdlib: - sysroot c_stdlib_version: @@ -15,7 +15,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '13' +- '14' docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 hardening: diff --git a/.ci_support/linux_64_channel_targetsconda-forge_mainhardeningnone.yaml b/.ci_support/linux_64_channel_targetsconda-forge_mainhardeningnone.yaml index b1042d8c..f67f041c 100644 --- a/.ci_support/linux_64_channel_targetsconda-forge_mainhardeningnone.yaml +++ b/.ci_support/linux_64_channel_targetsconda-forge_mainhardeningnone.yaml @@ -1,7 +1,7 @@ c_compiler: - gcc c_compiler_version: -- '13' +- '14' c_stdlib: - sysroot c_stdlib_version: @@ -15,7 +15,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '13' +- '14' docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 hardening: diff --git a/build-locally.py b/build-locally.py index d78427b5..8ac9b846 100755 --- a/build-locally.py +++ b/build-locally.py @@ -1,8 +1,11 @@ -#!/usr/bin/env python3 +#!/bin/sh +"""exec' "python3" "$0" "$@" #""" # fmt: off # fmt: on # # This file has been generated by conda-smithy in order to build the recipe # locally. # +# The line above this comment is a bash / sh / zsh guard +# to stop people from running it with the wrong interpreter import glob import os import platform diff --git a/conda-forge.yml b/conda-forge.yml index 3442a946..94b29161 100644 --- a/conda-forge.yml +++ b/conda-forge.yml @@ -1,3 +1,7 @@ +azure: + settings_osx: + pool: + vmImage: macos-14 bot: abi_migration_branches: - 16.x @@ -10,7 +14,4 @@ channel_priority: flexible github: branch_name: main tooling_branch_name: main -provider: - linux_aarch64: default - linux_ppc64le: default test: native_and_emulated diff --git a/recipe/build.sh b/recipe/build.sh index a32075d4..c7ec44fd 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -22,6 +22,7 @@ cmake -G Ninja \ -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_BUILD_TYPE=Release \ + -DLIBCXX_ENABLE_TIME_ZONE_DATABASE=ON \ -DLIBCXX_INCLUDE_BENCHMARKS=OFF \ -DLIBCXX_INCLUDE_DOCS=OFF \ -DLIBCXX_INCLUDE_TESTS=OFF \ diff --git a/recipe/compile_test.sh b/recipe/compile_test.sh index 3b787109..e0600ee8 100644 --- a/recipe/compile_test.sh +++ b/recipe/compile_test.sh @@ -1,38 +1,50 @@ set -xe -LINK_FLAGS="-Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -Wl,-v -v" +FLAGS="-Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -Wl,-v -v" # target platform is empty here now if [[ "$target_platform" == osx* ]]; then llvm-nm $PREFIX/lib/libc++.1.dylib + # to be able to use libc++'s tzdb code + FLAGS="${FLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" else - LINK_FLAGS="${LINK_FLAGS} -lc++abi" + FLAGS="${FLAGS} -lc++abi" fi FILES=test_sources/*.c for f in $FILES do - clang -O2 -g $f $LINK_FLAGS + clang -O2 -g $f $FLAGS ./a.out done FILES=test_sources/*.cpp for f in $FILES do - clang++ -stdlib=libc++ -O2 -g $f $LINK_FLAGS + clang++ -stdlib=libc++ -O2 -g $f $FLAGS ./a.out done FILES=test_sources/cpp11/*.cpp for f in $FILES do - clang++ -stdlib=libc++ -std=c++11 -O2 -g $f $LINK_FLAGS + clang++ -stdlib=libc++ -std=c++11 -O2 -g $f $FLAGS ./a.out done FILES=test_sources/cpp14/*.cpp for f in $FILES do - clang++ -stdlib=libc++ -std=c++14 -O2 -g $f $LINK_FLAGS + clang++ -stdlib=libc++ -std=c++14 -O2 -g $f $FLAGS ./a.out done + +# tzdb integration (experimental as of v19) +cd test_sources/tzdb +clang++ -stdlib=libc++ -fexperimental-library -std=c++20 -O2 -g tzdb.cpp -o tzdb $FLAGS +./tzdb + +# also test tzdb without any environment activation +unset PREFIX +unset CONDA_PREFIX +./tzdb diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index 51f94862..dd25aacd 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -6,10 +6,10 @@ cxx_compiler: # [osx] # libcxx only supports the last released GCC version, see # https://libcxx.llvm.org/index.html#platform-and-compiler-support c_compiler_version: # [unix] - - 13 # [linux] + - 14 # [linux] - "*" # [osx] cxx_compiler_version: # [unix] - - 13 # [linux] + - 14 # [linux] - "*" # [osx] # we want different hashes between osx-64 & osx-arm @@ -35,23 +35,23 @@ c_stdlib_version: # [linux] # avoided in production (which we enforce with a run-export). For more details see # https://libcxx.llvm.org/Hardening.html hardening: - - none # [osx] - none - debug + - none # [osx] # in some scenarios, libraries will load a cached _system_ libc++, and if we have an # ABI-mismatch with that system lib, segfaults ensue (see libcxx-testing-feedstock); # because the ABI changed with macOS 12, we build a version each for before & after sys_abi: # [osx] - - pre-12 # [osx] - post-12 # [osx] - post-12 # [osx] + - pre-12 # [osx] # publish the pre-12 ABI & hardened builds to a separate label channel_targets: - - conda-forge libcxx_macos_lt_12 # [osx] - conda-forge main - conda-forge libcxx_debug + - conda-forge libcxx_macos_lt_12 # [osx] zip_keys: - diff --git a/recipe/meta.yaml b/recipe/meta.yaml index cc28581e..96e9e15b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "18.1.8" %} +{% set version = "19.1.0" %} {% if sys_abi is undefined %} {% set sys_abi = "dummy" %} @@ -11,7 +11,7 @@ package: source: - url: https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-{{ version.replace(".rc", "-rc") }}.tar.gz - sha256: 09c08693a9afd6236f27a2ebae62cda656eba19021ef3f94d59e931d662d4856 + sha256: 0a08341036ca99a106786f50f9c5cb3fbe458b3b74cab6089fd368d0edb2edfe patches: # See https://discourse.llvm.org/t/shipping-custom-libc-on-macos/58606 - patches/0001-Fix-ABI-compatibility-with-system.patch # [sys_abi == "pre-12"] @@ -20,9 +20,11 @@ source: - patches/0003-disable-_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPT.patch # work around https://github.com/llvm/llvm-project/issues/90332 - patches/0004-Work-around-stray-nostdlib-flags-causing-errors-with.patch + # allow chrono implementation to work on osx + - patches/0005-patch-__libcpp_tzdb_directory-to-allow-use-on-osx.patch build: - number: 7 + number: 0 skip: true # [win] skip: true # [ppc64le or aarch64] @@ -38,9 +40,6 @@ requirements: - {{ compiler('c') }} - {{ stdlib('c') }} - python >3 # [not osx] - host: - # - clangdev {{ version }} # [not osx] - - llvmdev {{ version }} # [not osx] outputs: - name: libcxx-devel @@ -52,11 +51,15 @@ outputs: - libcxx =*=debug* # [hardening == "debug"] files: - include/c++ # [unix] + # for C++20 modules, which are installed into $PREFIX/share/libc++ + - share/libc++/* # [unix] - Library/include/c++ # [win] requirements: host: - {{ pin_subpackage("libcxx", exact=True) }} run: + # re-enable this once chrono implementation is in shared library + # - tzdata - {{ pin_subpackage("libcxx", max_pin=None) }} run_constrained: - __osx <12 # [osx and (sys_abi == "pre-12")] @@ -87,12 +90,20 @@ outputs: # i.e. everywhere there's a string "availability(macos,...,introduced=)" for osx version >10.13; # 'grep -v' inverts the match but returns non-zero exit code if no lines are returned; so we use 'wc -l'; # we want to have zero lines that don't either: contain our link or are for <=10.13 (lowest occurring in that file is 10.9) - - if [ 0 -eq $(cat ${PREFIX}/include/c++/v1/__availability | grep "availability(macos" | grep -vE "(conda-forge|10.9|10.1[0-3])" | wc -l) ]; then exit 0; else exit 1; fi # [osx] + - if [ 0 -ne $(cat ${PREFIX}/include/c++/v1/__configuration/availability.h | grep "availability(macos" | grep -vE "(conda-forge|10.9|10.1[0-3])" | wc -l) ]; then exit 1; fi # [osx] # !!!!!!!!!!!! README !!!!!!!!!!!!!!!!!! # we do not ship libcxxabi on OSX - this breaks exception passing - if [ -f $PREFIX/lib/libc++abi.dylib ]; then exit 1; fi # [osx] - test -f $PREFIX/lib/libc++abi.so # [linux] + # for full chrono support, libcxx needs leap-seconds.list, which + # isn't shipped in ubuntu-22.04 nor macos-14 images (ubuntu-24.04 + # should have it, but isn't available in azure pipelines yet). + - ls -lL /usr/share/zoneinfo + # This check is intended to start failing once an image starts shipping + # that file, so we can re-enable the leapsecond portion of the tzdb-tests + - if [ 0 -ne $(ls -lL /usr/share/zoneinfo | grep leap-seconds.list | wc -l) ]; then exit 1; fi + # Following 2 projects had issues with libc++, so check them # before releasing just to be sure. downstreams: # [osx] @@ -104,7 +115,6 @@ outputs: - libcxx-testing 0.18 # [osx] - libcxx-testing 0.17 # [osx] - libcxx-testing 0.16 # [osx] - - libcxx-testing 0.15 # [osx] {% endif %} - name: libcxx @@ -124,6 +134,7 @@ outputs: - lib/libc++.dylib # [osx] - lib/libc++.*.dylib # [osx] - Library/bin/c++*.dll # [win] + # static libs for cross-compilation, due to lack of host-exports - lib/libc++.a # [unix] - lib/libc++experimental.* # [unix] - Library/lib/c++*.lib # [win] diff --git a/recipe/patches/0001-Fix-ABI-compatibility-with-system.patch b/recipe/patches/0001-Fix-ABI-compatibility-with-system.patch index 41702b9a..dddf00f7 100644 --- a/recipe/patches/0001-Fix-ABI-compatibility-with-system.patch +++ b/recipe/patches/0001-Fix-ABI-compatibility-with-system.patch @@ -1,17 +1,17 @@ -From b461291f007bc7457a5a7f7219cd0943b8e7ba3d Mon Sep 17 00:00:00 2001 +From bf8c76c5be4a6923267959f629650d375ffe1fb5 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 13 Jul 2021 01:57:06 -0500 -Subject: [PATCH 1/4] Fix ABI compatibility with system +Subject: [PATCH 1/5] Fix ABI compatibility with system --- libcxx/src/locale.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp -index 73b24dbf595a..6a69d6fa2855 100644 +index 4efdc63c0966..812d1a386096 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp -@@ -176,10 +176,6 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { +@@ -174,10 +174,6 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { install(&make >(1u)); install(&make >(1u)); _LIBCPP_SUPPRESS_DEPRECATED_POP @@ -22,7 +22,7 @@ index 73b24dbf595a..6a69d6fa2855 100644 install(&make >(1u)); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS install(&make >(1u)); -@@ -218,6 +214,10 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { +@@ -216,6 +212,10 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS install(&make >(1u)); #endif @@ -33,7 +33,7 @@ index 73b24dbf595a..6a69d6fa2855 100644 } locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), name_(name) { -@@ -244,10 +244,6 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), +@@ -242,10 +242,6 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), install(new codecvt_byname(name_)); install(new codecvt_byname(name_)); _LIBCPP_SUPPRESS_DEPRECATED_POP @@ -44,7 +44,7 @@ index 73b24dbf595a..6a69d6fa2855 100644 install(new numpunct_byname(name_)); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS install(new numpunct_byname(name_)); -@@ -270,6 +266,10 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), +@@ -268,6 +264,10 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS install(new messages_byname(name_)); #endif diff --git a/recipe/patches/0002-custom-error-message-for-old-sdk.patch b/recipe/patches/0002-custom-error-message-for-old-sdk.patch index 5a489585..c89eac99 100644 --- a/recipe/patches/0002-custom-error-message-for-old-sdk.patch +++ b/recipe/patches/0002-custom-error-message-for-old-sdk.patch @@ -1,57 +1,98 @@ -From bacfd686f6d24164b4c6bbdc8cdf022740106991 Mon Sep 17 00:00:00 2001 +From 7a6b8cee3b11db797a01eb2bdd9a0e4c31bf6aca Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 29 Dec 2021 19:28:35 -0800 -Subject: [PATCH 2/4] custom error message for old sdk +Subject: [PATCH 2/5] custom error message for old sdk Co-Authored-By: H. Vetinari --- - libcxx/include/__availability | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) + libcxx/include/__configuration/availability.h | 20 +++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) -diff --git a/libcxx/include/__availability b/libcxx/include/__availability -index b8b2da9bb122..59fafbbee393 100644 ---- a/libcxx/include/__availability -+++ b/libcxx/include/__availability -@@ -188,13 +188,13 @@ - # define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 1 +diff --git a/libcxx/include/__configuration/availability.h b/libcxx/include/__configuration/availability.h +index ab483a07c9c1..70de9989b457 100644 +--- a/libcxx/include/__configuration/availability.h ++++ b/libcxx/include/__configuration/availability.h +@@ -135,12 +135,12 @@ + // LLVM 19 + // TODO: Fill this in + # define _LIBCPP_INTRODUCED_IN_LLVM_19 0 +-# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((unavailable)) ++# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE __attribute__((macos, strict, introduced = 15.0, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk")) + + // LLVM 18 + // TODO: Fill this in + # define _LIBCPP_INTRODUCED_IN_LLVM_18 0 +-# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE __attribute__((unavailable)) ++# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE __attribute__((macos, strict, introduced = 15.0, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk")) + + // LLVM 17 + # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140400) || \ +@@ -152,7 +152,7 @@ + # define _LIBCPP_INTRODUCED_IN_LLVM_17 1 # endif - # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \ -- __attribute__((availability(macos, strict, introduced = 10.15))) \ -+ __attribute__((availability(macos, strict, introduced = 10.15, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ - __attribute__((availability(ios, strict, introduced = 13.0))) \ - __attribute__((availability(tvos, strict, introduced = 13.0))) \ - __attribute__((availability(watchos, strict, introduced = 6.0))) - // clang-format off - # define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH \ -- _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \ -+ _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15,message=\"see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk\"))), apply_to=any(function,record))") \ - _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ - _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ - _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))") -@@ -217,7 +217,7 @@ - # define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1 + # define _LIBCPP_INTRODUCED_IN_LLVM_17_ATTRIBUTE \ +- __attribute__((availability(macos, strict, introduced = 14.4))) \ ++ __attribute__((availability(macos, strict, introduced = 14.4, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ + __attribute__((availability(ios, strict, introduced = 17.4))) \ + __attribute__((availability(tvos, strict, introduced = 17.4))) \ + __attribute__((availability(watchos, strict, introduced = 10.4))) +@@ -167,7 +167,7 @@ + # define _LIBCPP_INTRODUCED_IN_LLVM_16 1 + # endif + # define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE \ +- __attribute__((availability(macos, strict, introduced = 14.0))) \ ++ __attribute__((availability(macos, strict, introduced = 14.0, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ + __attribute__((availability(ios, strict, introduced = 17.0))) \ + __attribute__((availability(tvos, strict, introduced = 17.0))) \ + __attribute__((availability(watchos, strict, introduced = 10.0))) +@@ -182,7 +182,7 @@ + # define _LIBCPP_INTRODUCED_IN_LLVM_15 1 + # endif + # define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE \ +- __attribute__((availability(macos, strict, introduced = 13.4))) \ ++ __attribute__((availability(macos, strict, introduced = 13.4, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ + __attribute__((availability(ios, strict, introduced = 16.5))) \ + __attribute__((availability(tvos, strict, introduced = 16.5))) \ + __attribute__((availability(watchos, strict, introduced = 9.5))) +@@ -201,7 +201,7 @@ + # define _LIBCPP_INTRODUCED_IN_LLVM_13 1 # endif - # define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \ -- __attribute__((availability(macos, strict, introduced = 13.3))) \ -+ __attribute__((availability(macos, strict, introduced = 13.3, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ - __attribute__((availability(ios, strict, introduced = 16.3))) \ - __attribute__((availability(tvos, strict, introduced = 16.3))) \ - __attribute__((availability(watchos, strict, introduced = 9.3))) -@@ -234,7 +234,7 @@ - # define _LIBCPP_AVAILABILITY_HAS_SYNC 1 + # define _LIBCPP_INTRODUCED_IN_LLVM_13_ATTRIBUTE \ +- __attribute__((availability(macos, strict, introduced = 13.0))) \ ++ __attribute__((availability(macos, strict, introduced = 13.0, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ + __attribute__((availability(ios, strict, introduced = 16.0))) \ + __attribute__((availability(tvos, strict, introduced = 16.0))) \ + __attribute__((availability(watchos, strict, introduced = 9.0))) +@@ -216,7 +216,7 @@ + # define _LIBCPP_INTRODUCED_IN_LLVM_12 1 # endif - # define _LIBCPP_AVAILABILITY_SYNC \ -- __attribute__((availability(macos, strict, introduced = 11.0))) \ + # define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE \ +- __attribute__((availability(macos, strict, introduced = 12.3))) \ ++ __attribute__((availability(macos, strict, introduced = 12.3, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ + __attribute__((availability(ios, strict, introduced = 15.3))) \ + __attribute__((availability(tvos, strict, introduced = 15.3))) \ + __attribute__((availability(watchos, strict, introduced = 8.3))) +@@ -231,7 +231,7 @@ + # define _LIBCPP_INTRODUCED_IN_LLVM_11 1 + # endif + # define _LIBCPP_INTRODUCED_IN_LLVM_11_ATTRIBUTE \ +- __attribute__((availability(macos, strict, introduced = 11.0))) \ + __attribute__((availability(macos, strict, introduced = 11.0, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ - __attribute__((availability(ios, strict, introduced = 14.0))) \ - __attribute__((availability(tvos, strict, introduced = 14.0))) \ + __attribute__((availability(ios, strict, introduced = 14.0))) \ + __attribute__((availability(tvos, strict, introduced = 14.0))) \ __attribute__((availability(watchos, strict, introduced = 7.0))) -@@ -262,7 +262,7 @@ - // use availability annotations until that bug has been fixed. - # if 0 - # define _LIBCPP_AVAILABILITY_PMR \ -- __attribute__((availability(macos, strict, introduced = 14.0))) \ -+ __attribute__((availability(macos, strict, introduced = 14.0, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ - __attribute__((availability(ios, strict, introduced = 17.0))) \ - __attribute__((availability(tvos, strict, introduced = 17.0))) \ - __attribute__((availability(watchos, strict, introduced = 10.0))) +@@ -250,12 +250,12 @@ + # define _LIBCPP_INTRODUCED_IN_LLVM_9 1 + # endif + # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE \ +- __attribute__((availability(macos, strict, introduced = 10.15))) \ ++ __attribute__((availability(macos, strict, introduced = 10.15, message="see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk"))) \ + __attribute__((availability(ios, strict, introduced = 13.0))) \ + __attribute__((availability(tvos, strict, introduced = 13.0))) \ + __attribute__((availability(watchos, strict, introduced = 6.0))) + # define _LIBCPP_INTRODUCED_IN_LLVM_9_ATTRIBUTE_PUSH \ +- _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15))), apply_to=any(function,record))") \ ++ _Pragma("clang attribute push(__attribute__((availability(macos,strict,introduced=10.15,message=\"see https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk\"))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))") diff --git a/recipe/patches/0003-disable-_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPT.patch b/recipe/patches/0003-disable-_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPT.patch index 85774d2f..cbb03f1f 100644 --- a/recipe/patches/0003-disable-_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPT.patch +++ b/recipe/patches/0003-disable-_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPT.patch @@ -1,7 +1,7 @@ -From b696d088e01cfa8b3e7dd226342ca37bd8c95621 Mon Sep 17 00:00:00 2001 +From 1fa872f42eb17226d5f37425f393c72bc12cfc92 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 26 May 2024 22:04:04 +1100 -Subject: [PATCH 3/4] disable _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION +Subject: [PATCH 3/5] disable _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION unconditionally When _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS is not defined, things @@ -18,19 +18,21 @@ macOS baseline is >=15.0, as we rely on the libcxxabi shipped by the system. See also https://github.com/llvm/llvm-project/issues/77653 & https://github.com/llvm/llvm-project/issues/86077 --- - libcxx/include/__availability | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + libcxx/include/__configuration/availability.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/libcxx/include/__availability b/libcxx/include/__availability -index 59fafbbee393..50dab515d2a7 100644 ---- a/libcxx/include/__availability -+++ b/libcxx/include/__availability -@@ -103,7 +103,7 @@ +diff --git a/libcxx/include/__configuration/availability.h b/libcxx/include/__configuration/availability.h +index 70de9989b457..bbcb17a910aa 100644 +--- a/libcxx/include/__configuration/availability.h ++++ b/libcxx/include/__configuration/availability.h +@@ -352,8 +352,8 @@ // These macros controls the availability of __cxa_init_primary_exception // in the built library, which std::make_exception_ptr might use // (see libcxx/include/__exception/exception_ptr.h). --# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 1 -+# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0 - # define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION +-#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18 +-#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE ++#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0 ++#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION /* nothing */ - // These macros control the availability of all parts of that + // This controls the availability of C++23 , which + // has a dependency on the built library (it needs access to diff --git a/recipe/patches/0004-Work-around-stray-nostdlib-flags-causing-errors-with.patch b/recipe/patches/0004-Work-around-stray-nostdlib-flags-causing-errors-with.patch index 6527e1f3..73e21dec 100644 --- a/recipe/patches/0004-Work-around-stray-nostdlib-flags-causing-errors-with.patch +++ b/recipe/patches/0004-Work-around-stray-nostdlib-flags-causing-errors-with.patch @@ -1,7 +1,7 @@ -From 46bea2a31254d1d997c220685742f68f02f1f351 Mon Sep 17 00:00:00 2001 +From 2ff612a0e19739e0523c98f6580a09c4dbd6bd73 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Sun, 26 May 2024 13:01:28 +1100 -Subject: [PATCH 4/4] Work around stray `-nostdlib++` flags causing errors with +Subject: [PATCH 4/5] Work around stray `-nostdlib++` flags causing errors with C compiler --- diff --git a/recipe/patches/0005-patch-__libcpp_tzdb_directory-to-allow-use-on-osx.patch b/recipe/patches/0005-patch-__libcpp_tzdb_directory-to-allow-use-on-osx.patch new file mode 100644 index 00000000..29c0d42e --- /dev/null +++ b/recipe/patches/0005-patch-__libcpp_tzdb_directory-to-allow-use-on-osx.patch @@ -0,0 +1,25 @@ +From 9d8956c3caafe7460b5b29f469cb9acc8b7a01b9 Mon Sep 17 00:00:00 2001 +From: "H. Vetinari" +Date: Wed, 31 Jul 2024 14:57:49 +1100 +Subject: [PATCH 5/5] patch __libcpp_tzdb_directory to allow use on osx + +--- + libcxx/src/experimental/tzdb.cpp | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/libcxx/src/experimental/tzdb.cpp b/libcxx/src/experimental/tzdb.cpp +index d22de21c9981..bdd5afa5fa01 100644 +--- a/libcxx/src/experimental/tzdb.cpp ++++ b/libcxx/src/experimental/tzdb.cpp +@@ -48,11 +48,7 @@ namespace chrono { + // This function is weak so it can be overriden in the tests. The + // declaration is in the test header test/support/test_tzdb.h + _LIBCPP_WEAK string_view __libcpp_tzdb_directory() { +-#if defined(__linux__) + return "/usr/share/zoneinfo/"; +-#else +-# error "unknown path to the IANA Time Zone Database" +-#endif + } + + //===----------------------------------------------------------------------===// diff --git a/recipe/test_sources/tzdb/tzdb.cpp b/recipe/test_sources/tzdb/tzdb.cpp new file mode 100644 index 00000000..e1f76b84 --- /dev/null +++ b/recipe/test_sources/tzdb/tzdb.cpp @@ -0,0 +1,99 @@ +// adapted from upstream tests +// https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.1.0/libstdc%2B%2B-v3/testsuite/std/time/tzdb/1.cc +// https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.1.0/libstdc%2B%2B-v3/testsuite/std/time/tzdb/leap_seconds.cc + +#include +#include +#include +#include +#include + +// https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.1.0/libstdc%2B%2B-v3/testsuite/util/testsuite_hooks.h#L61-L70 +#define VERIFY(fn) \ + do \ + { \ + if (! (fn)) \ + { \ + __builtin_fprintf(stderr, \ + "%s:%d: %s: Assertion '%s' failed.\n", \ + __FILE__, __LINE__, __PRETTY_FUNCTION__, #fn); \ + __builtin_abort(); \ + } \ + } while (false) + +using namespace std::chrono; + +void +test_version() +{ + const tzdb& db = get_tzdb(); + VERIFY( &db == &get_tzdb_list().front() ); + + const char* func; + try { + func = "remote_version"; + VERIFY( db.version == remote_version() ); + func = "reload_tzdb"; + const tzdb& reloaded = reload_tzdb(); + if (reloaded.version == db.version) + VERIFY( &reloaded == &db ); + } catch (const std::exception&) { + std::printf("std::chrono::%s() failed\n", func); + // on exception, we fail louder than the upstream reference test + exit(1); + } +} + +void +test_current() +{ + const tzdb& db = get_tzdb(); + const time_zone* tz = db.current_zone(); + VERIFY( tz == std::chrono::current_zone() ); +} + +void +test_locate() +{ + const tzdb& db = get_tzdb(); + const time_zone* tz = db.locate_zone("GMT"); + VERIFY( tz != nullptr ); + VERIFY( tz->name() == "Etc/GMT" ); + VERIFY( tz == std::chrono::locate_zone("GMT") ); + VERIFY( tz == db.locate_zone("Etc/GMT") ); + VERIFY( tz == db.locate_zone("Etc/GMT+0") ); + + VERIFY( db.locate_zone(db.current_zone()->name()) == db.current_zone() ); +} + +void +test_all_zones() +{ + const tzdb& db = get_tzdb(); + + for (const auto& zone : db.zones) + VERIFY( locate_zone(zone.name())->name() == zone.name() ); + + for (const auto& link : db.links) + VERIFY( locate_zone(link.name()) == locate_zone(link.target()) ); +} + +void +test_load_leapseconds() +{ + const auto& db = get_tzdb(); + auto len = db.leap_seconds.size(); + std::printf("found %zu leapseconds\n", len); + + // this is correct as of tzdata 2024a + // disabled currently due to missing leap-seconds.list, see meta.yaml + // VERIFY( db.leap_seconds.size() == 27 ); +} + +int main() +{ + test_version(); + test_current(); + test_locate(); + test_load_leapseconds(); +}