Merge pull request #265307 from reckenrode/clang16-fixes-batch2

rubyPackages.iconv, v8: fix build with clang 16

authored by Weijia Wang and committed by GitHub 023d20ae 7d2381f7

+110 -1
+5
pkgs/development/ruby-modules/gem-config/default.nix
··· 369 369 }; 370 370 371 371 iconv = attrs: { 372 + dontBuild = false; 372 373 buildFlags = lib.optional stdenv.isDarwin "--with-iconv-dir=${libiconv}"; 374 + patches = [ 375 + # Fix incompatible function pointer conversion errors with clang 16 376 + ./iconv-fix-incompatible-function-pointer-conversions.patch 377 + ]; 373 378 }; 374 379 375 380 idn-ruby = attrs: {
+51
pkgs/development/ruby-modules/gem-config/iconv-fix-incompatible-function-pointer-conversions.patch
··· 1 + diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c 2 + index 2801049..77fae7e 100644 3 + --- a/ext/iconv/iconv.c 4 + +++ b/ext/iconv/iconv.c 5 + @@ -188,7 +188,7 @@ static VALUE iconv_convert _((iconv_t cd, VALUE str, long start, long length, in 6 + static VALUE iconv_s_allocate _((VALUE klass)); 7 + static VALUE iconv_initialize _((int argc, VALUE *argv, VALUE self)); 8 + static VALUE iconv_s_open _((int argc, VALUE *argv, VALUE self)); 9 + -static VALUE iconv_s_convert _((struct iconv_env_t* env)); 10 + +static VALUE iconv_s_convert _((VALUE env)); 11 + static VALUE iconv_s_iconv _((int argc, VALUE *argv, VALUE self)); 12 + static VALUE iconv_init_state _((VALUE cd)); 13 + static VALUE iconv_finish _((VALUE self)); 14 + @@ -204,7 +204,7 @@ static VALUE charset_map; 15 + * Returns the map from canonical name to system dependent name. 16 + */ 17 + static VALUE 18 + -charset_map_get(void) 19 + +charset_map_get(VALUE klass) 20 + { 21 + return charset_map; 22 + } 23 + @@ -642,7 +642,7 @@ iconv_s_allocate(VALUE klass) 24 + } 25 + 26 + static VALUE 27 + -get_iconv_opt_i(VALUE i, VALUE arg) 28 + +get_iconv_opt_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg)) 29 + { 30 + VALUE name; 31 + #if defined ICONV_SET_TRANSLITERATE || defined ICONV_SET_DISCARD_ILSEQ 32 + @@ -784,8 +784,9 @@ iconv_s_open(int argc, VALUE *argv, VALUE self) 33 + } 34 + 35 + static VALUE 36 + -iconv_s_convert(struct iconv_env_t* env) 37 + +iconv_s_convert(VALUE env_value) 38 + { 39 + + struct iconv_env_t* env = (struct iconv_env_t*)env_value; 40 + VALUE last = 0; 41 + 42 + for (; env->argc > 0; --env->argc, ++env->argv) { 43 + @@ -906,7 +907,7 @@ list_iconv(unsigned int namescount, const char *const *names, void *data) 44 + 45 + #if defined(HAVE_ICONVLIST) || defined(HAVE___ICONV_FREE_LIST) 46 + static VALUE 47 + -iconv_s_list(void) 48 + +iconv_s_list(VALUE klass) 49 + { 50 + #ifdef HAVE_ICONVLIST 51 + int state;
+44
pkgs/stdenv/adapters.nix
··· 42 42 stdenv.override (prev: { allowedRequisites = null; extraBuildInputs = (prev.extraBuildInputs or []) ++ pkgs; }); 43 43 44 44 45 + # Override the libc++ dynamic library used in the stdenv to use the one from the platform’s 46 + # default stdenv. This allows building packages and linking dependencies with different 47 + # compiler versions while still using the same libc++ implementation for compatibility. 48 + # 49 + # Note that this adapter still uses the headers from the new stdenv’s libc++. This is necessary 50 + # because older compilers may not be able to parse the headers from the default stdenv’s libc++. 51 + overrideLibcxx = stdenv: 52 + assert stdenv.cc.libcxx != null; 53 + let 54 + llvmLibcxxVersion = lib.getVersion llvmLibcxx; 55 + stdenvLibcxxVersion = lib.getVersion stdenvLibcxx; 56 + 57 + stdenvLibcxx = pkgs.stdenv.cc.libcxx; 58 + stdenvCxxabi = pkgs.stdenv.cc.libcxx.cxxabi; 59 + 60 + llvmLibcxx = stdenv.cc.libcxx; 61 + llvmCxxabi = stdenv.cc.libcxx.cxxabi; 62 + 63 + libcxx = pkgs.runCommand "${stdenvLibcxx.name}-${llvmLibcxxVersion}" { 64 + outputs = [ "out" "dev" ]; 65 + inherit cxxabi; 66 + isLLVM = true; 67 + } '' 68 + mkdir -p "$dev/nix-support" 69 + ln -s '${stdenvLibcxx}' "$out" 70 + echo '${stdenvLibcxx}' > "$dev/nix-support/propagated-build-inputs" 71 + ln -s '${lib.getDev llvmLibcxx}/include' "$dev/include" 72 + ''; 73 + 74 + cxxabi = pkgs.runCommand "${stdenvCxxabi.name}-${llvmLibcxxVersion}" { 75 + outputs = [ "out" "dev" ]; 76 + inherit (stdenvCxxabi) libName; 77 + } '' 78 + mkdir -p "$dev/nix-support" 79 + ln -s '${stdenvCxxabi}' "$out" 80 + echo '${stdenvCxxabi}' > "$dev/nix-support/propagated-build-inputs" 81 + ln -s '${lib.getDev llvmCxxabi}/include' "$dev/include" 82 + ''; 83 + in 84 + overrideCC stdenv (stdenv.cc.override { 85 + inherit libcxx; 86 + extraPackages = [ cxxabi pkgs.pkgsTargetTarget."llvmPackages_${lib.versions.major llvmLibcxxVersion}".compiler-rt ]; 87 + }); 88 + 45 89 # Override the setup script of stdenv. Useful for testing new 46 90 # versions of the setup script without causing a rebuild of 47 91 # everything.
+10 -1
pkgs/top-level/all-packages.nix
··· 25481 25481 25482 25482 ucommon = callPackage ../development/libraries/ucommon { }; 25483 25483 25484 - v8 = darwin.apple_sdk_11_0.callPackage ../development/libraries/v8 { }; 25484 + v8 = callPackage ../development/libraries/v8 ( 25485 + let 25486 + stdenv' = if stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc.cc) "16" 25487 + then overrideLibcxx llvmPackages_15.stdenv 25488 + else stdenv; 25489 + in 25490 + { 25491 + stdenv = if stdenv'.isDarwin then overrideSDK stdenv' "11.0" else stdenv'; 25492 + } 25493 + ); 25485 25494 25486 25495 intel-vaapi-driver = callPackage ../development/libraries/intel-vaapi-driver { }; 25487 25496