fix(auth): stamp valid LC_ID_DYLIB in extconf builds for macOS 26/27 dyld
rb-sys's generated Makefile (fixup_libnames) ends the build with `install_name_tool -id "" $(DLLIB)`, leaving the bundle with an empty LC_ID_DYLIB install name. dyld on macOS 26/27 rejects that load command ("load command #4 string extends beyond end of load command"), so the extension fails to dlopen and every consumer 500s at `require "auth"`. Post-process the generated Makefile in extconf.rb to stamp `@rpath/auth.bundle` instead. This covers the `gem install` (source gem) build path; the existing Rakefile enhancement only covers `rake native gem` builds, which is why installs from the published source gem were still broken. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Seto Elkahfi committed
Jul 2, 2026 at 21:10 UTC
12e21bad3d2ea505fc8d1c76896f86ab2145649e
1 file changed
+12
sdk/gems/auth/ext/auth/extconf.rb
+12
@@ -4,3 +4,15 @@ require 'mkmf'
4
require 'rb_sys/mkmf'
5
6
create_rust_makefile('auth/auth')
7
+
8
+# rb-sys (fixup_libnames) appends `install_name_tool -id "" $(DLLIB)` to the
9
+# generated Makefile, blanking the bundle's LC_ID_DYLIB install name. dyld on
10
+# macOS 26/27 rejects an empty dylib-ID string ("load command string extends
11
+# beyond end of load command"), so the extension fails to dlopen. Rewrite that
12
+# step to stamp a valid @rpath id instead. This covers the `gem install`
13
+# (extconf) build path; the Rakefile covers `rake native gem` builds.
14
+if RUBY_PLATFORM.include?('darwin') && File.exist?('Makefile')
15
+ makefile = File.read('Makefile')
16
+ patched = makefile.gsub('install_name_tool -id ""', 'install_name_tool -id "@rpath/auth.bundle"')
17
+ File.write('Makefile', patched) if patched != makefile
18
+end