From 7535f51b61b1b245ca8293fe5c4b4969c0c844a3 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 26 Sep 2024 17:17:51 +0000 Subject: [PATCH 1/2] depends: Fix incompatibility between libsodium 1.0.20 and Clang 18 See https://github.com/jedisct1/libsodium/discussions/1413 --- depends/packages/libsodium.mk | 3 +- .../libsodium/1.0.20-immintrin-conflict.diff | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 depends/patches/libsodium/1.0.20-immintrin-conflict.diff diff --git a/depends/packages/libsodium.mk b/depends/packages/libsodium.mk index cb13dd4634f..c0b9fbc4472 100644 --- a/depends/packages/libsodium.mk +++ b/depends/packages/libsodium.mk @@ -4,12 +4,13 @@ $(package)_download_path=https://download.libsodium.org/libsodium/releases/ $(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=ebb65ef6ca439333c2bb41a0c1990587288da07f6c7fd07cb3a18cc18d30ce19 $(package)_dependencies= -$(package)_patches=1.0.15-pubkey-validation.diff 1.0.15-signature-validation.diff +$(package)_patches=1.0.15-pubkey-validation.diff 1.0.15-signature-validation.diff 1.0.20-immintrin-conflict.diff $(package)_config_opts= define $(package)_preprocess_cmds patch -p1 < $($(package)_patch_dir)/1.0.15-pubkey-validation.diff && \ patch -p1 < $($(package)_patch_dir)/1.0.15-signature-validation.diff && \ + patch -p1 < $($(package)_patch_dir)/1.0.20-immintrin-conflict.diff && \ cd $($(package)_build_subdir); DO_NOT_UPDATE_CONFIG_SCRIPTS=1 ./autogen.sh endef diff --git a/depends/patches/libsodium/1.0.20-immintrin-conflict.diff b/depends/patches/libsodium/1.0.20-immintrin-conflict.diff new file mode 100644 index 00000000000..e58a0904694 --- /dev/null +++ b/depends/patches/libsodium/1.0.20-immintrin-conflict.diff @@ -0,0 +1,34 @@ +diff -ur libsodium-1.0.20-orig/src/libsodium/randombytes/internal/randombytes_internal_random.c libsodium-1.0.20/src/libsodium/randombytes/internal/randombytes_internal_random.c +--- libsodium-1.0.20-orig/src/libsodium/randombytes/internal/randombytes_internal_random.c 2024-05-25 12:15:18.000000000 +0000 ++++ libsodium-1.0.20/src/libsodium/randombytes/internal/randombytes_internal_random.c 2024-09-26 18:11:50.173273070 +0000 +@@ -44,14 +44,6 @@ + #ifdef BLOCK_ON_DEV_RANDOM + # include + #endif +-#ifdef HAVE_RDRAND +-# ifdef __clang__ +-# pragma clang attribute push(__attribute__((target("rdrnd"))), apply_to = function) +-# elif defined(__GNUC__) +-# pragma GCC target("rdrnd") +-# endif +-# include +-#endif + + #include "core.h" + #include "crypto_core_hchacha20.h" +@@ -109,6 +101,15 @@ + # endif + #endif + ++#ifdef HAVE_RDRAND ++# ifdef __clang__ ++# pragma clang attribute push(__attribute__((target("rdrnd"))), apply_to = function) ++# elif defined(__GNUC__) ++# pragma GCC target("rdrnd") ++# endif ++# include ++#endif ++ + typedef struct InternalRandomGlobal_ { + int initialized; + int random_data_source_fd; From 8c8df866c252fb69b37a9848fa319885a89d2e9a Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 26 Sep 2024 20:31:28 +0000 Subject: [PATCH 2/2] depends: Downgrade libc++ for MinGW to 18.1.6-1 This fixes an `undefined symbol: __sys_nerr` error. --- depends/packages/libcxx.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/depends/packages/libcxx.mk b/depends/packages/libcxx.mk index c1a09712948..39532126d24 100644 --- a/depends/packages/libcxx.mk +++ b/depends/packages/libcxx.mk @@ -1,6 +1,6 @@ package=libcxx $(package)_version=$(if $(native_clang_version_$(host_arch)_$(host_os)),$(native_clang_version_$(host_arch)_$(host_os)),$(if $(native_clang_version_$(host_os)),$(native_clang_version_$(host_os)),$(native_clang_default_version))) -$(package)_msys2_version=18.1.8-1 +$(package)_msys2_version=18.1.6-1 ifneq ($(canonical_host),$(build)) ifneq ($(host_os),mingw32) @@ -30,7 +30,7 @@ else $(package)_download_path=https://repo.msys2.org/mingw/x86_64 $(package)_download_file=mingw-w64-x86_64-libc++-$($(package)_msys2_version)-any.pkg.tar.zst $(package)_file_name=mingw-w64-x86_64-libcxx-$($(package)_msys2_version)-any.pkg.tar.zst -$(package)_sha256_hash=4673dba0e8c4bac3c4d645a4a64b947855228b21c82f6366b201e7636a78bc1a +$(package)_sha256_hash=6857cc24cbe326c0cd571e52872bffe95f64ab67a8c5032c04875a9778fdece7 define $(package)_stage_cmds mkdir -p $($(package)_staging_prefix_dir)/lib && \