Opened 4 years ago

Closed 4 years ago

#62624 closed defect (fixed)

ruby30 fails to build on macOS 11.2.3

Reported by: josephsacco Owned by: kimuraw (kimura wataru)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: ruby, Big Sur Cc:
Port: ruby30

Description

Platform:

iMac Late 2015 4 GHz Quad-Core intel Core i7, macOS Big Sur 11.2.3

Problems occur when compiling bigdecimail.c.

make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_ruby30/ruby30/work/ruby-3.0.0/ext/bigdecimal'
compiling bigdecimal.c
In file included from bigdecimal.c:13:
./bigdecimal.h:122:1: error: redefinition of 'rb_array_const_ptr'
rb_array_const_ptr(VALUE a)
^
../.././include/ruby/internal/core/rarray.h:184:1: note: previous definition is here
rb_array_const_ptr(VALUE a)
^
In file included from bigdecimal.c:13:
./bigdecimal.h:139:1: error: static declaration of 'rb_sym2str' follows non-static declaration
rb_sym2str(VALUE sym)
^
../.././include/ruby/internal/symbol.h:63:7: note: previous declaration is here
VALUE rb_sym2str(VALUE);
      ^
bigdecimal.c:108:1: error: static declaration of 'rb_rational_num' follows non-static declaration
rb_rational_num(VALUE rat)
^
../.././include/ruby/internal/intern/rational.h:39:7: note: previous declaration is here
VALUE rb_rational_num(VALUE rat);
      ^
bigdecimal.c:120:1: error: static declaration of 'rb_rational_den' follows non-static declaration
rb_rational_den(VALUE rat)
^
../.././include/ruby/internal/intern/rational.h:40:7: note: previous declaration is here
VALUE rb_rational_den(VALUE rat);
      ^
bigdecimal.c:132:1: error: static declaration of 'rb_complex_real' follows non-static declaration
rb_complex_real(VALUE cmp)
^
../.././include/ruby/internal/intern/complex.h:38:7: note: previous declaration is here
VALUE rb_complex_real(VALUE z);
      ^
bigdecimal.c:144:1: error: static declaration of 'rb_complex_imag' follows non-static declaration
rb_complex_imag(VALUE cmp)
^
../.././include/ruby/internal/intern/complex.h:39:7: note: previous declaration is here
VALUE rb_complex_imag(VALUE z);
      ^
6 errors generated.
make[2]: *** [bigdecimal.o] Error 1

Attachments (2)

config.log (1.5 MB) - added by josephsacco 4 years ago.
config.log
mkmf.log (38.5 KB) - added by josephsacco 4 years ago.
mkmf.log

Download all attachments as: .zip

Change History (10)

comment:1 Changed 4 years ago by mf2k (Frank Schima)

Cc: kimuraw@… removed
Owner: set to kimuraw
Status: newassigned

comment:2 Changed 4 years ago by kimuraw (kimura wataru)

Status: assignedaccepted

I cannot reproduce the error. re-install XcodeTools might solve your problem.

see https://github.com/rbenv/ruby-build/issues/1505#issuecomment-752274233

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ sudo xcode-select -s /Library/Developer/CommandLineTools

comment:3 Changed 4 years ago by josephsacco

Uninstalling and reinstalling CommandLineTools [yet again... :-)] did not solve the problem:

I checked the tool path:

cavandish:~ jsacco$ xcode-select -p
/Library/Developer/CommandLineTools

All seems well. So what is the cause of the problem?

Examining the code in bigdecimal.h, I see that the (re)declaration of each of those errant functions is protected by an #ifndef MACRO directive. For example:

#ifndef HAVE_RB_ARRAY_CONST_PTR
static inline const VALUE *
rb_array_const_ptr(VALUE a)
{
    return FIX_CONST_VALUE_PTR((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
    RARRAY(a)->as.ary : RARRAY(a)->as.heap.ptr);
}
#endif

Searching the source code, I do not see where HAVE_RB_ARRAY_CONST_PTR is previously set.

cavandish:ruby-3.0.0 jsacco$ grep -R HAVE_RB_ARRAY_CONST_PTR *
ext/bigdecimal/bigdecimal.h:#ifndef HAVE_RB_ARRAY_CONST_PTR

So something is amiss...

-Joseph

comment:4 Changed 4 years ago by kimuraw (kimura wataru)

I updated port:ruby30 to 3.0.1.

If this problem was not solved, could you attach the following log files?

  • config.log
  • mkmf.log of ext/bigdecimal
% sudo port selfupdate
% sudo port clean ruby30
% sudo port -nsf build ruby30
% cd `port work ruby30`
% ls -l ruby-3.0.1/config.log
-rw-r--r--  1 macports  wheel  1556352 Apr 25 21:16 ruby-3.0.1/config.log
% ls -l ruby-3.0.1/ext/bigdecimal/mkmf.log
-rw-r--r--  1 macports  wheel  24114 Apr 25 21:16 ruby-3.0.1/ext/bigdecimal/mkmf.log

Changed 4 years ago by josephsacco

Attachment: config.log added

config.log

Changed 4 years ago by josephsacco

Attachment: mkmf.log added

mkmf.log

comment:5 Changed 4 years ago by josephsacco

Process followed:

cavandish:~ jsacco$ sudo port selfupdate
Password:
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.6.4 installed,
MacPorts base version 2.6.4 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated
cavandish:~ jsacco$ port outdated
No installed ports are outdated.
cavandish:~ jsacco$ sudo port clean ruby30
--->  Cleaning ruby30
cavandish:~ jsacco$ sudo port -nsf build ruby30
Warning: The macOS 11.2 SDK does not appear to be installed. Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line Tools package by running `xcode-select --install'.
--->  Computing dependencies for ruby30
--->  Fetching distfiles for ruby30
--->  Verifying checksums for ruby30
--->  Extracting ruby30
--->  Configuring ruby30
--->  Building ruby30
Error: Failed to build ruby30: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_ruby30/ruby30/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port ruby30 failed

Note: Xcode command line tools are installed

-Joseph

comment:6 Changed 4 years ago by kimuraw (kimura wataru)

Thanks Joseph,

I reproduced this error when I activated port:binutils. I'll fix the Portfile of ruby30.

As an ad-hoc solution, you can install ruby30 with temporally deactivation of port:binutils.

% sudo port deactivate binutils
% sudo port clean ruby30
% sudo port install ruby30
% sudo port activate binutils

comment:7 Changed 4 years ago by josephsacco

You are welcome... :-)

I can confirm that your suggested work-around succeeds.

The reactivation of binutils issues an "interesting" warning:

cavandish:~ jsacco$ sudo port activate binutils
--->  Computing dependencies for binutils
--->  Activating binutils @2.36.1_0
--->  Cleaning binutils
--->  Some of the ports you installed have notes:
  binutils has the following notes:
    Having binutils installed will cause some other ports to fail to build.
    Consider uninstalling binutils.

-Joseph

comment:8 Changed 4 years ago by kimura wataru <kimuraw@…>

Resolution: fixed
Status: acceptedclosed

In 5d8aa4d11a5f62de7f0b24ebfe09101ccc9901fb/macports-ports (master):

lang/ruby30: fix build error when port:binutils is installed

Closes: #62624

Note: See TracTickets for help on using tickets.