Skip to content

Commit 4410831

Browse files
authored
Merge pull request #224597 from Homebrew/r
r: fix for clang 17
2 parents 5ffde4a + 3362aa3 commit 4410831

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

Formula/r/r.rb

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ class R < Formula
1111
end
1212

1313
bottle do
14-
sha256 arm64_sequoia: "48e4817e21ff16cd70fe7a3bd11ffb6b117f43b4a6a710d7bbb3c70bb374e239"
15-
sha256 arm64_sonoma: "f2f3b9c3ea83b6a6418ef6d277b46cbaaf58da22fb1bf98bd40ceb4be5bc3bd3"
16-
sha256 arm64_ventura: "b4eeb8e81c83ee1d4d2c3e346c06abb71cfcb173f26cf351011edf5304cf660b"
17-
sha256 sonoma: "87bde25906088da3adaec6dfe8526b8e6992532ffcadfa76039d215cd8dcef72"
18-
sha256 ventura: "6af721dd46ae2605802e8b4719f20d9a8be745da7a8742ad06d9dc40a9bf9316"
19-
sha256 arm64_linux: "d21463fdd1a28126e092e84c3ff604dfc51d21c8a612c5aa4de89b986a070b37"
20-
sha256 x86_64_linux: "030a0cc88f27535c502c31118d10cae6d8398c519df565b275c15dea3d1b9379"
14+
rebuild 1
15+
sha256 arm64_sequoia: "d1ddce0ad0d522ee76fb51606bf534c657485926b84abdcc639d44c597092b1f"
16+
sha256 arm64_sonoma: "863812140563d5032eba8bd4fbad25a1491959211859fbbd771360cdb9bee4f9"
17+
sha256 arm64_ventura: "975e8373997f5d7fc5410dac375f17cfa974e75faf60ae03174d2975577ac95e"
18+
sha256 sonoma: "c5b065319f527a4f58980dcd755924e2bed7219c126f219d1e1fb28185665810"
19+
sha256 ventura: "39f5db524319dab2d2a0c38d26b76fb11d48e5b8a800a6d997642334f252af12"
20+
sha256 arm64_linux: "0a4686667b78d716ae8011cd23a3c87d770195d4675d501132f205c2b3d9096d"
21+
sha256 x86_64_linux: "c9cf750aeabb259ff475472ac3cf9e720c43eed195aa72f495f5eafaf16913ad"
2122
end
2223

2324
depends_on "pkgconf" => :build
@@ -65,6 +66,10 @@ class R < Formula
6566
# needed to preserve executable permissions on files without shebangs
6667
skip_clean "lib/R/bin", "lib/R/doc"
6768

69+
# Fix build with clang 17
70+
# https://github.com/wch/r-source/commit/489a6b8d330bb30da82329f1949f44a0f633f1e8
71+
patch :DATA
72+
6873
def install
6974
# `configure` doesn't like curl 8+, but convince it that everything is ok.
7075
# TODO: report this upstream.
@@ -165,3 +170,28 @@ def post_install
165170
shell_output("#{bin}/Rscript -e 'library(tcltk)' -e 'tclvalue(.Tcl(\"tk windowingsystem\"))'").chomp
166171
end
167172
end
173+
__END__
174+
diff -pur R-4.5.0/src/nmath/mlutils.c R-4.5.0-patched/src/nmath/mlutils.c
175+
--- R-4.5.0/src/nmath/mlutils.c 2025-03-14 00:02:15
176+
+++ R-4.5.0-patched/src/nmath/mlutils.c 2025-05-24 12:16:15
177+
@@ -105,7 +105,20 @@ double R_pow_di(double x, int n)
178+
return pow;
179+
}
180+
181+
+/* It is not clear why these are being defined in standalone nmath:
182+
+ * but that they are is stated in the R-admin manual.
183+
+ *
184+
+ * In R NA_AREAL is a specific NaN computed during initialization.
185+
+ */
186+
+#if defined(__clang__) && defined(NAN)
187+
+// C99 (optionally) has NAN, which is a float but will coerce to double.
188+
+double NA_REAL = NAN;
189+
+#else
190+
+// ML_NAN is defined as (0.0/0.0) in nmath.h
191+
+// Fails to compile in Intel ics 2025.0, Apple clang 17, LLVM clang 20
192+
double NA_REAL = ML_NAN;
193+
+#endif
194+
+
195+
double R_PosInf = ML_POSINF, R_NegInf = ML_NEGINF;
196+
197+
#include <stdio.h>

0 commit comments

Comments
 (0)