Bug 2343981

Summary: ruby: FTBFS in Fedora 42
Product: [Fedora] Fedora Reporter: Vít Ondruch <vondruch>
Component: rubyAssignee: Vít Ondruch <vondruch>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 42CC: dmalcolm, fweimer, jakub, jlaw, josmyers, jprokop, jwakely, mcermak, mpolacek, msebor, mtasaka, nickc, nixuser, pvalena, ruby-packagers-sig, sipoyare, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: aarch64   
OS: Linux   
URL: https://koschei.fedoraproject.org/package/ruby
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-08 12:33:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2343986    
Bug Blocks: 245418    

Description Vít Ondruch 2025-02-05 14:39:36 UTC
Description of problem:
Package ruby fails to build from source in Fedora 42.

Version-Release number of selected component (if applicable):
3.4.1-22.fc42

Steps to Reproduce:
koji build --scratch f42 ruby-3.4.1-22.fc42.src.rpm

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/ruby

Reproducible: Always

Comment 1 Vít Ondruch 2025-02-05 14:41:48 UTC
~~~
gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -fPIC  -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/aarch64-linux -I/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/include -I/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1 -I/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/prism -I/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/enc/unicode/15.0.0   -Dmodular_gc_dir=""    -o compile.o -c /builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/compile.c
In file included from /builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/compile.c:21:
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/vm_callinfo.h: In function ‘vm_ci_dump’:
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/internal.h:89:72: error: ‘RUBY_FUNCTION_NAME_STRING’ undeclared (first use in this function)
   89 | #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/vm_callinfo.h:183:9: note: in expansion of macro ‘rp’
  183 |         rp(ci);
      |         ^~
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/internal.h:89:72: note: each undeclared identifier is reported only once for each function it appears in
   89 | #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/vm_callinfo.h:183:9: note: in expansion of macro ‘rp’
  183 |         rp(ci);
      |         ^~
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/vm_callinfo.h: In function ‘vm_ci_new_’:
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/internal.h:89:72: error: ‘RUBY_FUNCTION_NAME_STRING’ undeclared (first use in this function)
   89 | #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/ruby-3.4.1-build/ruby-3.4.1/vm_callinfo.h:221:16: note: in expansion of macro ‘rp’
  221 |     if (debug) rp(ci);
      |                ^~
make: *** [Makefile:461: compile.o] Error 1
~~~

Seems to be change in GCC behavior on AArch64. gcc-15.0.1-0.4.fc42 worked just fine, gcc-15.0.1-0.4.fc42 seems to cause the issue.

Comment 2 Jakub Jelinek 2025-02-05 15:21:04 UTC
I don't see a failed build in koji, where was this built?  Is that aarch64 only or all arches? What the second gcc NVR is supposed to be (both are the same)?
Looking at ruby's configure.ac, seems it is defined based on configure check:
AC_CACHE_CHECK(for function name string predefined identifier,
    rb_cv_function_name_string,
    [AS_CASE(["$target_os"],[openbsd*],[
      rb_cv_function_name_string=__func__
     ],[
      rb_cv_function_name_string=no
      RUBY_WERROR_FLAG([
        for func in __func__ __FUNCTION__; do
            AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <stdio.h>]],
                                            [[puts($func);]])],
            [rb_cv_function_name_string=$func
            break])
        done
      ])
    ])]
)
AS_IF([test "$rb_cv_function_name_string" != no], [
    AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string])
])

So, can you look at config.log to see what warnings or errors were emitted?

Comment 3 Mamoru TASAKA 2025-02-05 15:26:38 UTC
Actually not gcc but binutils change (2.43.50-12.fc42 -> 2.44-1.fc42)
I am going to write detail shortly

Comment 4 Mamoru TASAKA 2025-02-05 15:37:20 UTC
So with aarch64, trying to compile and link the above "conftest.c" with binutils-2.44-1.fc42.aarch64
shows warnings (which I don't know what to mean):

/usr/lib/gcc/aarch64-redhat-linux/15/../../../../lib64/libgmp.so: warning: GCS is required by -z gcs, but this shared library lacks the necessary property note. The dynamic loader might not enable GCS or refuse to load the program unless all the shared library dependencies have the GCS marking.
/usr/lib/gcc/aarch64-redhat-linux/15/../../../../lib64/libcrypt.so: warning: GCS is required by -z gcs, but this shared library lacks the necessary property note. The dynamic loader might not enable GCS or refuse to load the program unless all the shared library dependencies have the GCS marking.

and "RUBY_WERROR_FLAG" treats the above warnings as error.

So whether binutils should be fixed, or the above "RUBY_WERROR_FLAG" should be unset for now (on aarch64)

Comment 5 Mamoru TASAKA 2025-02-05 16:00:09 UTC
Current (one of) ruby.src side workaround seems:

```
diff --git a/ruby.spec b/ruby.spec
index 4396a7f..59f98e2 100644
--- a/ruby.spec
+++ b/ruby.spec
@@ -789,6 +789,10 @@ autoconf
 mkdir -p %{_vpath_builddir}
 pushd %{_vpath_builddir}
 
+%ifarch aarch64
+export LDFLAGS="$LDFLAGS -Wl,-z,gcs-report=none"
+%endif
+
 %configure \
         --with-rubylibprefix='%{ruby_libdir}' \
         --with-archlibdir='%{_libdir}' \
```

Comment 6 Siddhesh Poyarekar 2025-02-06 17:14:48 UTC
(In reply to Mamoru TASAKA from comment #5)
> +export LDFLAGS="$LDFLAGS -Wl,-z,gcs-report=none"

Minimally, -Wl,-z,gcs-report-dynamic=none.  That's the offending warning.

Comment 7 Siddhesh Poyarekar 2025-02-07 13:40:17 UTC
FYI, this is being fixed in binutils by disabling gcs-report-dynamic by default.  Builds are in progress, in case you want to wait and try that out instead of putting a workaround in ruby spec:

https://src.fedoraproject.org/rpms/binutils/pull-request/62
https://src.fedoraproject.org/rpms/binutils/pull-request/63

Comment 8 Mamoru TASAKA 2025-02-08 12:33:12 UTC
ruby is now okay with binutils-2.44-3.fc42 , koschei is now green.