Skip to content

Commit

Permalink
ruby-grpc: gcc-14 fixes (#367783)
Browse files Browse the repository at this point in the history
* ruby-modules/gem: don't clobber NIX_CFLAGS_COMPILE

* gem-config/grpc: apply patch for gcc-14

https://boringssl.googlesource.com/boringssl/+/c70190368c7040c37c1d655f0690bcde2b109a0d

add -Wno-error=incompatible-pointer-types to NIX_CFLAGS_COMPILE and
remove the other flags as NIX_CFLAGS_COMPILE were getting clobbered since
7121ef6 (2021)
  • Loading branch information
paparodeo authored Dec 25, 2024
1 parent 06af86f commit 45b0aee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
21 changes: 11 additions & 10 deletions pkgs/development/ruby-modules/gem-config/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# This separates "what to build" (the exact gem versions) from "how to build"
# (to make gems behave if necessary).

{ lib, fetchurl, fetchpatch2, writeScript, ruby, libkrb5, libxml2, libxslt, python2, stdenv, which
{ lib, fetchurl, fetchpatch, fetchpatch2, writeScript, ruby, libkrb5, libxml2, libxslt, python2, stdenv, which
, libiconv, postgresql, nodejs, clang, sqlite, zlib, imagemagick, lasem
, pkg-config , ncurses, xapian, gpgme, util-linux, tzdata, icu, libffi
, cmake, libssh2, openssl, openssl_1_1, libmysqlclient, git, perl, pcre2, gecode_3, curl
Expand Down Expand Up @@ -407,15 +407,16 @@ in
++ lib.optional (lib.versionAtLeast attrs.version "1.53.0" && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) autoSignDarwinBinariesHook;
buildInputs = [ openssl ];
hardeningDisable = [ "format" ];
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=stringop-overflow"
"-Wno-error=implicit-fallthrough"
"-Wno-error=sizeof-pointer-memaccess"
"-Wno-error=cast-function-type"
"-Wno-error=class-memaccess"
"-Wno-error=ignored-qualifiers"
"-Wno-error=tautological-compare"
"-Wno-error=stringop-truncation"
env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
patches = [
(fetchpatch {
name = "gcc-14-fixes.patch";
url = "https://boringssl.googlesource.com/boringssl/+/c70190368c7040c37c1d655f0690bcde2b109a0d%5E%21/?format=TEXT";
decode = "base64 -d";
stripLen=1;
extraPrefix = "third_party/boringssl-with-bazel/src/";
hash = "sha256-1QyQm5s55op268r72dfExNGV+UyV5Ty6boHa9DQq40U=";
})
];
dontBuild = false;
postPatch = ''
Expand Down
17 changes: 10 additions & 7 deletions pkgs/development/ruby-modules/gem/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,16 @@ lib.makeOverridable (

# As of ruby 3.0, ruby headers require -fdeclspec when building with clang
# Introduced in https://github.com/ruby/ruby/commit/0958e19ffb047781fe1506760c7cbd8d7fe74e57
env.NIX_CFLAGS_COMPILE = toString (
lib.optionals
(ruby.rubyEngine == "ruby" && stdenv.cc.isClang && lib.versionAtLeast ruby.version.major "3")
[
"-fdeclspec"
]
);
env = lib.optionalAttrs (attrs ? env) attrs.env // {
NIX_CFLAGS_COMPILE = toString (
lib.optionals
(ruby.rubyEngine == "ruby" && stdenv.cc.isClang && lib.versionAtLeast ruby.version.major "3")
[
"-fdeclspec"
]
++ lib.optional (attrs.env.NIX_CFLAGS_COMPILE or "" != "") attrs.env.NIX_CFLAGS_COMPILE
);
};

buildPhase =
attrs.buildPhase or ''
Expand Down

0 comments on commit 45b0aee

Please sign in to comment.