Skip to content

Commit dc8ccd8

Browse files
committed
ext(native): work around darwin linker behavior in Ruby 3.2
rake-compiler/rake-compiler-dock#87
1 parent 06e47b4 commit dc8ccd8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ext/sqlite3/extconf.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ def configure_packaged_libraries
8787
end
8888

8989
flags.each { |flag| append_ldflags(flag) }
90+
91+
# See https://github.com/rake-compiler/rake-compiler-dock/issues/87 for more info.
92+
if cross_build? &&
93+
darwin? &&
94+
Gem::Requirement.new("~> 3.2").satisfied_by?(Gem::Version.new(RbConfig::CONFIG["ruby_version"]))
95+
append_ldflags("-Wl,-flat_namespace")
96+
end
9097
end
9198
end
9299

@@ -172,6 +179,10 @@ def download
172179
minimal_recipe.download
173180
end
174181

182+
def darwin?
183+
RbConfig::CONFIG["target_os"].include?("darwin")
184+
end
185+
175186
def print_help
176187
print(<<~TEXT)
177188
USAGE: ruby #{$PROGRAM_NAME} [options]

0 commit comments

Comments
 (0)