Skip to content

Commit

Permalink
Cleanup invalid dylib id reference on mac (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianks authored Aug 15, 2024
1 parent fc04029 commit 4b311b3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gem/lib/rb_sys/mkmf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def create_rust_makefile(target, &blk)
full_cargo_command = cargo_command(srcdir, builder)

global_rustflags = []
global_rustflags << "--cfg=rb_sys_gem" unless builder.use_cargo_build
# Re-enable if this causes issues, but it should be fine and it prevents unnecessary recompilation
# global_rustflags << "--cfg=rb_sys_gem" unless builder.use_cargo_build
global_rustflags << "--cfg=rb_sys_use_stable_api_compiled_fallback" if builder.use_stable_api_compiled_fallback?

make_install = +<<~MAKE
Expand Down Expand Up @@ -134,6 +135,7 @@ def create_rust_makefile(target, &blk)
install-so: $(DLLIB) #{timestamp_file("sitearchdir")}
\t$(ECHO) installing $(DLLIB) to $(RUBYARCHDIR)
\t#{fixup_libnames}
\t$(Q) $(MAKEDIRS) $(RUBYARCHDIR)
\t$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
Expand Down Expand Up @@ -278,6 +280,12 @@ def force_install_rust_toolchain?(builder)
find_executable("cargo").nil?
end

def fixup_libnames
return unless find_executable("install_name_tool")

'$(Q) install_name_tool -id "" $(DLLIB)'
end

def if_eq_stmt(a, b)
if $nmake
"!IF #{a.inspect} == #{b.inspect}"
Expand Down

0 comments on commit 4b311b3

Please sign in to comment.