ruby 3.0 or 3.1 with --enable-dtrace requires debugflags="-g1"
Ruby 3.0 and 3.1 compile fine on OpenIndiana with gcc 7.5 or gcc 10.
However when configuring with --enable-dtrace the default
debugflags of the ruby configure script is set to "debugflags=-ggdb3"
It appears that this causes the Illumos link editor "ld" to core dump / crash with SIGSEGV in the build process.
Workaround is to configure ruby 3.0 or 3.1 with debugflags="-g1"
./configure --with-gcc --enable-dtrace debugflags="-g1"
I reported this to the Ruby developers in ruby Issue #18335 owner ngoto (Naohisa Goto).
The reply there is "Patches are welcome to check them without breaking things on other platforms (including Oracle Solaris 11).
I guess that the error/failure only occurs when processing large-scale complex source codes, and simple short source codes could be processed without error/failure. In such cases, I think it is very difficult to write short check codes that can be used in configure scripts, and I give up trying to do so."
I believe that the --enable-dtrace code was contributed in the past to the developers of Ruby,
the Ruby source code has a pointer to an old 2005 posting
where older issues with ruby and dtrace support were discussed.