Skip to content

Instantly share code, notes, and snippets.

@unurgunite
Created May 23, 2026 08:59
Show Gist options
  • Select an option

  • Save unurgunite/4d6f9ecade222d9f5c6f6e8503ffdc38 to your computer and use it in GitHub Desktop.

Select an option

Save unurgunite/4d6f9ecade222d9f5c6f6e8503ffdc38 to your computer and use it in GitHub Desktop.
Fix build fail on macOS 26 for Ruby 3.0
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -62,7 +62,11 @@ static ID id_eq;
static ID id_half;
/* MACRO's to guard objects from GC by keeping them in stack */
+#ifdef RBIMPL_ATTR_MAYBE_UNUSED
+#define ENTER(n) RBIMPL_ATTR_MAYBE_UNUSED() volatile VALUE vStack[n];int iStack=0
+#else
#define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0
+#endif
#define PUSH(x) (vStack[iStack++] = (VALUE)(x))
#define SAVE(p) PUSH((p)->obj)
#define GUARD_OBJ(p,y) ((p)=(y), SAVE(p))
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -657,7 +657,12 @@
SRC
print "fixing apple's netinet6/in6.h ..."; $stdout.flush
- in6 = File.read("/usr/include/#{hdr}")
+ in6_path = "/usr/include/#{hdr}"
+ if !File.exist?(in6_path)
+ sdk = `xcrun --show-sdk-path 2>/dev/null`.strip
+ in6_path = File.join(sdk, "usr/include", hdr) if !sdk.empty?
+ end
+ in6 = File.read(in6_path)
if in6.gsub!(/\*\(const\s+__uint32_t\s+\*\)\(const\s+void\s+\*\)\(&(\(\w+\))->s6_addr\[(\d+)\]\)/) do
i, r = $2.to_i.divmod(4)
if r.zero?
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -660,7 +660,12 @@
SRC
print "fixing apple's netinet6/in6.h ..."; $stdout.flush
- in6 = File.read("/usr/include/#{hdr}")
+ in6_path = "/usr/include/#{hdr}"
+ if !File.exist?(in6_path)
+ sdk = `xcrun --show-sdk-path 2>/dev/null`.strip
+ in6_path = File.join(sdk, "usr/include", hdr) if !sdk.empty?
+ end
+ in6 = File.read(in6_path)
if in6.gsub!(/\*\(const\s+__uint32_t\s+\*\)\(const\s+void\s+\*\)\(&(\(\w+\))->s6_addr\[(\d+)\]\)/) do
i, r = $2.to_i.divmod(4)
if r.zero?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment