Skip to content

Commit a76e8b4

Browse files
committed
Use a simpler workaround for platform mixup issue
When `linux` and `linux-musl` platforms are both defined in the cross_platform array, then a rake task is defined for `lib/2.7/pg_ext.so` which links to `linux` instead of `linux-musl`. Disabling native tasks for the running ruby platform disables compiling `lib/2.7/pg_ext.so` completely. The mixed platform rake definition otherwise leads to a rake dependency chain like this: ``` rake aborted! Tasks: TOP => pkg/pg-1.6.0-x86_64-linux-musl.gem => lib/2.7/pg_ext.so => copy:pg_ext:x86_64-linux:2.7.8 => tmp/x86_64-linux/pg_ext/2.7.8/pg_ext.so => tmp/x86_64-linux/pg_ext/2.7.8/Makefile ```
1 parent f181983 commit a76e8b4

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Rakefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,7 @@ Rake::ExtensionTask.new do |ext|
7070
ext.lib_dir = 'lib'
7171
ext.source_pattern = "*.{c,h}"
7272
ext.cross_compile = true
73-
74-
# Activate current cross compiled platform only.
75-
# This is to work around the issue that `linux` platform is selected in `linux-musl` image.
76-
ext.cross_platform = CrossLibraries.map(&:platform).select do |pl|
77-
m = ENV["RCD_IMAGE"]&.match(/:(?<ruby_ver>[\d\.]+)-mri-(?<platform>[-\w]+)$/)
78-
m && m[:platform] == pl
79-
end
73+
ext.cross_platform = CrossLibraries.map(&:platform)
8074

8175
ext.cross_config_options += CrossLibraries.map do |xlib|
8276
{
@@ -141,7 +135,7 @@ CrossLibraries.each do |xlib|
141135
bundle install --local &&
142136
#{ "rake install_darwin_mig[__arm64__]" if platform =~ /arm64-darwin/ }
143137
#{ "rake install_darwin_mig[__x86_64__]" if platform =~ /x86_64-darwin/ }
144-
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=#{RakeCompilerDock.ruby_cc_version("~>2.7", "~>3.0")}
138+
rake native:#{platform} pkg/#{$gem_spec.full_name}-#{platform}.gem MAKEOPTS=-j`nproc` RUBY_CC_VERSION=#{RakeCompilerDock.ruby_cc_version("~>2.7", "~>3.0")} RAKE_EXTENSION_TASK_NO_NATIVE=true
145139
EOT
146140
end
147141
desc "Build the native binary gems"

0 commit comments

Comments
 (0)