Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Patch to fix ruby-3.1.4 compilation issue #1907

Merged
merged 4 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions config/patches/ruby/ruby-3.1.4-configure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- ruby-3.1.4/configure.ac.org 2024-05-28 14:20:02
+++ ruby-3.1.4/configure.ac 2024-05-28 14:21:35
@@ -363,6 +363,12 @@
icc_version=`echo =__ICC | $CC -E -xc - | sed '/^=/!d;s///;/^__ICC/d'`
test -n "$icc_version" || icc_version=0
# RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
+ AC_CACHE_CHECK([if thread-local storage is supported], [rb_cv_tls_supported],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int __thread conftest;]])],
+ [rb_cv_tls_supported=yes],
+ [rb_cv_tls_supported=no])])
+ AS_IF([test x"$rb_cv_tls_supported" != xyes],
+ [AC_DEFINE(RB_THREAD_LOCAL_SPECIFIER_IS_UNSUPPORTED)])
], [
linker_flag=
])
--- ruby-3.1.4/thread_pthread.h.org 2024-05-28 14:27:35
+++ ruby-3.1.4/thread_pthread.h 2024-05-28 14:28:30
@@ -72,7 +72,7 @@

#if __STDC_VERSION__ >= 201112
#define RB_THREAD_LOCAL_SPECIFIER _Thread_local
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) && !defined(RB_THREAD_LOCAL_SPECIFIER_IS_UNSUPPORTED)
/* note that ICC (linux) and Clang are covered by __GNUC__ */
#define RB_THREAD_LOCAL_SPECIFIER __thread
#else
21 changes: 9 additions & 12 deletions config/software/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,6 @@
version("3.0.2") { source sha256: "5085dee0ad9f06996a8acec7ebea4a8735e6fac22f22e2d98c3f2bc3bef7e6f1" }
version("3.0.1") { source sha256: "369825db2199f6aeef16b408df6a04ebaddb664fb9af0ec8c686b0ce7ab77727" }

version("2.7.7") { source sha256: "e10127db691d7ff36402cfe88f418c8d025a3f1eea92044b162dd72f0b8c7b90" }
version("2.7.6") { source sha256: "e7203b0cc09442ed2c08936d483f8ac140ec1c72e37bb5c401646b7866cb5d10" }
version("2.7.5") { source sha256: "2755b900a21235b443bb16dadd9032f784d4a88f143d852bc5d154f22b8781f1" }
version("2.7.4") { source sha256: "3043099089608859fc8cce7f9fdccaa1f53a462457e3838ec3b25a7d609fbc5b" }
version("2.7.3") { source sha256: "8925a95e31d8f2c81749025a52a544ea1d05dad18794e6828709268b92e55338" }

version("2.6.10") { source sha256: "0dc609f263d49c4176d5725deefc337273676395985b5e017789373e8cadf16e" }
version("2.6.9") { source sha256: "eb7bae7aac64bf9eb2153710a4cafae450ccbb62ae6f63d573e1786178b0efbb" }
version("2.6.8") { source sha256: "1807b78577bc08596a390e8a41aede37b8512190e05c133b17d0501791a8ca6d" }
version("2.6.7") { source sha256: "e4227e8b7f65485ecb73397a83e0d09dcd39f25efd411c782b69424e55c7a99e" }

source url: "https://cache.ruby-lang.org/pub/ruby/#{version.match(/^(\d+\.\d+)/)[0]}/ruby-#{version}.tar.gz"
internal_source url: "#{ENV["ARTIFACTORY_REPO_URL"]}/#{name}/#{name}-#{version}.tar.gz",
authorization: "X-JFrog-Art-Api:#{ENV["ARTIFACTORY_TOKEN"]}"
Expand Down Expand Up @@ -168,7 +157,9 @@
if windows? && version.satisfies?("~> 3.0.0")
patch source: "ruby-win32_resolv.patch", plevel: 0, env: patch_env
end

if suse? && version.satisfies?("= 3.1.4")
patch source: "ruby-3.1.4-configure.patch", plevel: 1, env: patch_env
end
# RHEL6 has a base compiler that does not support -fstack-protector-strong, but we
# cannot build modern ruby on the RHEL6 base compiler, and the configure script
# determines that it supports that flag and so includes it and then ultimately
Expand All @@ -178,6 +169,12 @@
#
if rhel? && platform_version.satisfies?("< 7")
patch source: "ruby-no-stack-protector-strong.patch", plevel: 1, env: patch_env
else
if rhel? && platform_version.satisfies?(">=7")
if version.satisfies?("= 3.1.4")
patch source: "ruby-3.1.4-configure.patch", plevel: 1, env: patch_env
end
end
end

# accelerate requires of c-extension.
Expand Down