Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

3.0.0-preview2 install failed (Mac OS X 10.15.7 using ruby-build 20201210) #1505

Closed
naro143 opened this issue Dec 12, 2020 · 15 comments
Closed

Comments

@naro143
Copy link

naro143 commented Dec 12, 2020

$ rbenv install 3.0.0-preview2

Downloading openssl-1.1.1i.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
Installing openssl-1.1.1i...
Installed openssl-1.1.1i to /Users/naro143/.rbenv/versions/3.0.0-preview2

Downloading ruby-3.0.0-preview2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-preview2.tar.gz
Installing ruby-3.0.0-preview2...
ruby-build: using readline from homebrew

BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20201210)

Inspect or clean up the working tree at /var/folders/q7/xvn3h3gn2t18rdxx2n7grd_0wzqfmf/T/ruby-build.20201213040353.36221.Nqoey4
Results logged to /var/folders/q7/xvn3h3gn2t18rdxx2n7grd_0wzqfmf/T/ruby-build.20201213040353.36221.log

Last 10 log lines:
compiling enc/unicode.c
compiling enc/utf_8.c
compiling enc/trans/newline.c
./revision.h unchanged
compiling version.c
linking miniruby
generating x86_64-darwin19-fake.rb
x86_64-darwin19-fake.rb updated
make: *** [exe/ruby] Segmentation fault: 11
make: *** Deleting file `exe/ruby'
zsh: exit 1

$ xcodebuild -version
Xcode 11.1
Build version 11A1027

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.7
BuildVersion: 19H2

3.0.0-preview1 install succeeds, but 3.0.0-preview2 install does not.

@naro143 naro143 changed the title 3.0.0-preview2 install faild 3.0.0-preview2 install failed Dec 12, 2020
@naro143 naro143 changed the title 3.0.0-preview2 install failed 3.0.0-preview2 install failed (Mac OS X 10.15.7 using ruby-build 20201210) Dec 12, 2020
@hsbt hsbt transferred this issue from rbenv/rbenv Dec 13, 2020
@dark-panda
Copy link

Similarly, I can't get 3.0.0-preview2 or 3.0.0-dev to build on Mojave with similar-ish errors...

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:109: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:121: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:133: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:145: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
make[1]: *** [ext/bigdecimal/all] Error 2
make: *** [build-ext] Error 2

Similar build failures were posted to the Ruby bug tracker for Ruby 2.6.2:

https://bugs.ruby-lang.org/issues/15726

3.0.0-preview1, 2.7.1 and 2.7.2 build fine, however.

$ xcodebuild -version
Xcode 11.3.1
Build version 11C504

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G6042

$ RUBY_CONFIGURE_OPTS="--with-readline-dir=/opt/local --with-libyaml-dir=/opt/local --with-openssl-dir=/opt/local" CONFIGURE_OPTS="--disable-install-doc --with-openssl --with-opt-dir=/opt/local" rbenv install --verbose 3.0.0-dev

@dark-panda
Copy link

As a follow up to my comment above, I've created a ticket in the Ruby issue tracker along with a fix for the bigdecimal issue. See here for details:

https://bugs.ruby-lang.org/issues/17486

Basically, reverting the following commit will allow builds to run successfully on darwin again:

ruby/ruby@ed01cc8

@v3rmin
Copy link

v3rmin commented Dec 28, 2020

@naro143 I get the same error (Segmentation fault: 11) when installing ruby 3.0.0. Did you solve it?

@naro143
Copy link
Author

naro143 commented Dec 29, 2020

@v3rmin I don't know how to solve this problem. ruby 3.0.0. has the same problem.

@hsbt
Copy link
Member

hsbt commented Dec 29, 2020

Hi, all.

Can you try with the following instructions?

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

I think your developer toolchain is broken by macOS or Xcode upgrade installation.

@AlexMarold
Copy link

@hsbt Thank you!
I had the same problem and your instructions fixed it for me.

@naro143
Copy link
Author

naro143 commented Dec 30, 2020

@hsbt
Thank you!
solved this problem👏

@dark-panda
Copy link

@hsbt This does not resolve the issue. I did what you asked on a Catalina Macbook Pro and the issue is still present. Applying the patch revert I mentioned does however work. I also have access to a Big Sur Macbook Pro that I can try with once the upgrade is done.

@hsbt
Copy link
Member

hsbt commented Dec 30, 2020

I couldn't reproduce it. ruby-build is working fine with my Catalina and Big Sur environment.

@dark-panda
Copy link

This also happens when building from source directly from a fresh git clone so it's not an issue with ruby-build per se, but with Ruby itself it seems. As to why you are unable to reproduce, I'm not sure, but I've had the issue now on Mojave, Catalina, and I will soon check on Big Sur.

I've posted to the Ruby bug tracker so we can perhaps follow the progress there to see if anyone else has a similar issue. I can say with certainty that reverting patch in question definitely resolves the issue for me at least on the v3_0_0 tag and on master, but as to why I'm experiencing it specifically is a different matter.

@dark-panda
Copy link

The bug report on bugs.ruby-lang.org is here:

https://bugs.ruby-lang.org/issues/17486

machupicchubeta added a commit to machupicchubeta/dotfiles that referenced this issue Jan 18, 2021
It seems the developer toolchain is broken by macOS or Xcode upgrade installation.
Revise the developer toolchain before installing.

Refs.
- rbenv/ruby-build#1505
- https://bugs.ruby-lang.org/issues/17486
- http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/94072
- https://public-inbox.org/ruby-core/[email protected]/
@arrowcircle
Copy link

Hey! I have the same issue with Catalina and reinstalling command line tools didnt help. Any ideas how to fix it and install ruby?

@asgeo1
Copy link

asgeo1 commented Aug 12, 2021

I was having this same issue installing ruby 3.0.2 on Catalina. I got it to work by applying a patch that reverts this commit

  1. Save this into a file called my_custom_patch_file.patch
diff --git a/configure.ac b/configure.ac
index 2dcebdde9f..b11809c6d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -191,6 +191,13 @@ AS_CASE(["${build_os}"],
 ],
 [aix*], [
     AC_PATH_TOOL([NM], [nm], [/usr/ccs/bin/nm], [/usr/ccs/bin:$PATH])
+],
+[darwin*], [
+    AS_IF([libtool 2>&1 | grep no_warning_for_no_symbols > /dev/null], [
+        ac_cv_prog_ac_ct_RANLIB=:
+        ac_cv_prog_ac_ct_AR='libtool -static'
+        rb_cv_arflags='-no_warning_for_no_symbols -o'
+    ])
 ])
 AS_CASE(["${target_os}"],
 [cygwin*|mingw*], [
  1. Install via rbenv:
$ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])"
$ rbenv install --patch 3.0.2 < /path/to/my_custom_patch_file.patch

Downloading ruby-3.0.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.gz
Installing ruby-3.0.2...
patching file configure.ac
ruby-build: using readline from homebrew
Installed ruby-3.0.2 to /Users/asgeo1/.rbenv/versions/3.0.2

$ rbenv local 3.0.2
$ ruby --version
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin19]

@Blatant22
Copy link

This advice was perfect, and still relevant for ruby 3.1.2. Thanks

@marshmallowcreme
Copy link

@asgeo1 This patch worked for me on my Apple Silicon M1 with Monterey 12.5 installing Ruby 3.1.2 via Homebrew and rbenv.

@rbenv rbenv locked and limited conversation to collaborators Jul 26, 2022
@hsbt hsbt converted this issue into discussion #2016 Jul 26, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants