Skip to content

Commit b9984b0

Browse files
committed
Use a simpler workaround for platform mixup issue
When `linux` platform comes first, then a rake task is defined for `lib/2.7/pg_ext.so` which links to `linux` instead of `linux-musl`. Defining `linux-musl` first fixes this since the task is defined only once in: https://github.com/rake-compiler/rake-compiler/blob/ad13dd1ae1000e1ef91b95f3c7782ccca4c1c591/lib/rake/extensiontask.rb#L349 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 b9984b0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Rakefile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ CrossLibraries = [
4949
['x64-mingw-ucrt', 'mingw64', 'x86_64-w64-mingw32'],
5050
['x86-mingw32', 'mingw', 'i686-w64-mingw32'],
5151
['x64-mingw32', 'mingw64', 'x86_64-w64-mingw32'],
52-
['x86_64-linux', 'linux-x86_64', 'x86_64-linux-gnu'],
5352
['x86_64-linux-musl', 'linux-x86_64', 'x86_64-unknown-linux-musl'],
54-
['aarch64-linux', 'linux-aarch64', 'aarch64-linux-gnu'],
53+
['x86_64-linux', 'linux-x86_64', 'x86_64-linux-gnu'],
5554
['aarch64-linux-musl', 'linux-aarch64', 'aarch64-linux-musl'],
55+
['aarch64-linux', 'linux-aarch64', 'aarch64-linux-gnu'],
5656
['x86_64-darwin', 'darwin64-x86_64', 'x86_64-apple-darwin'],
5757
['arm64-darwin', 'darwin64-arm64', 'arm64-apple-darwin'],
5858
].map do |platform, openssl_config, toolchain|
@@ -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
{

0 commit comments

Comments
 (0)