rvm icon indicating copy to clipboard operation
rvm copied to clipboard

MAC M1 Big Sur ruby compile issue for all rubies. Error running '__rvm_make -j8',

Open anuj-bluebash opened this issue 3 years ago • 58 comments

$rvm -v
rvm 1.29.11 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

Description

$rvm install 2.3.0 `ruby-2.3.0 - #configuring - please wait ruby-2.3.0 - #post-configuration - please wait ruby-2.3.0 - #compiling - please wait Error running '__rvm_make -j8', please read /Users/sheriff/.rvm/log/1610613964_ruby-2.3.0/make.log

I have tried for almost all version and it goes failed on compile step.

Screenshot 2021-01-14 at 2 28 07 PM

anuj-bluebash avatar Jan 14 '21 08:01 anuj-bluebash

I had the same issue due to openssl. I had to download an old version of openssl and bind it to the ruby installation.

Download : https://github.com/openssl/openssl/releases/tag/OpenSSL_1_0_2u

$> tar -xzf openssl-OpenSSL_1_0_2u.tar.gz
$> cd openssl-1.0.2u
$> ./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/[email protected]
$> make
$> make test
$> sudo make install
$> rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/[email protected]

You will maybe need to run:

$> rvm osx-ssl-certs update all

GuillaumeCisco avatar Jan 15 '21 09:01 GuillaumeCisco

@GuillaumeCisco Thanks your solution work form me. Earlier I installed brew install [email protected] but it was not working.

After your solution i just run arch -x86_64 rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/[email protected] and its working perfectly fine

Thanks

anuj-bluebash avatar Jan 15 '21 10:01 anuj-bluebash

I will try to add this as default behaviour of RVM

pkuczynski avatar Jan 15 '21 10:01 pkuczynski

@GuillaumeCisco I just got another issue with ruby 2.2.1.

arch -x86_64 rvm install 2.2.1 --with-openssl-dir=/usr/local/opt/[email protected]

Error running '__rvm_make install', Screenshot 2021-01-15 at 4 53 15 PM

anuj-bluebash avatar Jan 15 '21 11:01 anuj-bluebash

I am trying to install ruby 2.5.5 and getting the same error. I tried @GuillaumeCisco 's solution but still showing the same error Screenshot 2021-01-20 at 12 35 09 PM

divnoorkang avatar Jan 20 '21 07:01 divnoorkang

I have the same issue for 2.2.1 :/

GuillaumeCisco avatar Jan 20 '21 08:01 GuillaumeCisco

@GuillaumeCisco @divnoorkang Can you guys provide the content of make.log for us? 🤝

pedrofurtado avatar Jan 26 '21 00:01 pedrofurtado

After following the steps added by @GuillaumeCisco I have got the below error.

Apple M1 arch

Screenshot 2021-02-13 at 1 08 53 PM

And If I follow steps given by anuj-bluebash then getting compilation error. Please find make.log

make.log

However, rvm install 2.4.10 ran successfully without any additional efforts

prsanjay avatar Feb 13 '21 07:02 prsanjay

hi, tried all variants but still have this error Error running '__rvm_make -j8', please read /Users/**/.rvm/log/1613567019_ruby-2.6.3/make.log

mac os 11.2

whitemystyle avatar Feb 17 '21 14:02 whitemystyle

$> tar -xzf openssl-OpenSSL_1_0_2u.tar.gz
$> cd openssl-1.0.2u
$> ./Configure darwin64-x86_64-cc --prefix=/usr/local/opt/[email protected]
$> make
$> make test
$> sudo make install
$> rvm install 2.3.8 --with-openssl-dir=/usr/local/opt/[email protected]

tried it, openssl has been installed succesfully, but it still can't install ruby 2.6.3

whitemystyle avatar Feb 17 '21 15:02 whitemystyle

After following the steps added by @GuillaumeCisco I have got the below error. (Apple M1 using rosseta terminal)

rvm install 2.6.7 --with-openssl-dir=/usr/local/opt/[email protected]
ruby-2.6.7 - #removing src/ruby-2.6.7 - please wait
Checking requirements for osx.
Certificates bundle '/usr/local/etc/[email protected]/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/m.gutenplan/.rvm/rubies/ruby-2.6.7, this may take a while depending on your cpu(s)...
ruby-2.6.7 - #downloading ruby-2.6.7, this may take a while depending on your connection...
ruby-2.6.7 - #extracting ruby-2.6.7 to /Users/m.gutenplan/.rvm/src/ruby-2.6.7 - please wait
ruby-2.6.7 - #configuring - please wait
ruby-2.6.7 - #post-configuration - please wait
ruby-2.6.7 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/m.gutenplan/.rvm/log/1617704995_ruby-2.6.7/make.log

There has been an error while running make. Halting the installation.

Here is make.log file content:

There has been an error while running make. Halting the installation.
making mjit_config.h
compiling mjit_compile.c
compiling node.c
compiling numeric.c
compiling object.c
compiling pack.c
compiling parse.c
compiling proc.c
compiling process.c
compiling random.c
compiling range.c
compiling rational.c
compiling re.c
compiling regcomp.c
compiling regenc.c
compiling regerror.c
compiling regexec.c
compiling regparse.c
compiling regsyntax.c
compiling ruby.c
compiling safe.c
compiling signal.c
compiling sprintf.c
In file included from sprintf.c:1255:
./vsnprintf.c:832:8: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
                            IS_PRI_EXTRA_MARK(fmt)) {
                            ^~~~~~~~~~~~~~~~~~~~~~
./vsnprintf.c:825:34: note: expanded from macro 'IS_PRI_EXTRA_MARK'
           strncmp((s)+1, PRI_EXTRA_MARK+1, \
                          ~~~~~~~~~~~~~~^~
./vsnprintf.c:832:8: note: use array indexing to silence this warning
./vsnprintf.c:825:34: note: expanded from macro 'IS_PRI_EXTRA_MARK'
           strncmp((s)+1, PRI_EXTRA_MARK+1, \
                                        ^
compiling st.c
compiling strftime.c
compiling string.c
compiling struct.c
compiling symbol.c
1 warning generated.
compiling thread.c
compiling time.c
compiling transcode.c
compiling transient_heap.c
compiling util.c
compiling variable.c
compiling vm.c
./revision.h unchanged
compiling vm_backtrace.c
vm.c:2295:9: error: implicit declaration of function 'rb_native_mutex_destroy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        rb_native_mutex_destroy(&vm->waitpid_lock);
        ^
vm.c:2489:34: warning: expression does not compute the number of elements in this array; element type is 'const int', not 'VALUE' (aka 'unsigned long') [-Wsizeof-array-div]
                             sizeof(ec->machine.regs) / sizeof(VALUE));
                                    ~~~~~~~~~~~~~~~~  ^
vm.c:2489:34: note: place parentheses around the 'sizeof(VALUE)' expression to silence this warning
1 warning and 1 error generated.
make: *** [vm.o] Error 1
make: *** Waiting for unfinished jobs....
+__rvm_make:0> return 2

Hope we can get some answers :)

mgutenplan avatar Apr 06 '21 10:04 mgutenplan

Using rbenv and doing steps from (https://github.com/rbenv/ruby-build/issues/1691#issuecomment-780527500) Fixed my problem

mgutenplan avatar Apr 06 '21 11:04 mgutenplan

The solutions above did not work on my case. rvm install "ruby-2.6.3" --with-out-ext=fiddle did.

EdgardoRodriguezSolano avatar May 09 '21 23:05 EdgardoRodriguezSolano

Apple M1: I just spent hours trying to figure out what's wrong and I finally wrapped my head around it. You don't need to use an old version of SSL you just need to install your rubies with a rosetta terminal (find terminal in your applications folder, right click, get info, click "Open using Rosetta", close your terminal and reopen if you have to). after doing that you can just install any rubies you want with rvm install 2.7.3 etc.

I would change the terminal back to not open with Rosetta after you've installed whatever you needed so you're actually using your M1 chip from now on.

This can get confusing if you've tried all the stuff above like I did. You might end up with several different versions of openssl with things in your bash or zshrc path and whatnot messing everything up. You can uninstall uneeded old versions by checking out what you have with brew list and then brew uninstall [email protected] etc.

StephenVNelson avatar May 30 '21 18:05 StephenVNelson

I didn't try SSL 1.0. I'd prefer to use current stable software, but the other ideas for rvm did not work on my M1 Mac trying to install ruby 2.6.6. All attempts result in the same error. Looks like I'll need to use rbenv.

Screen Shot 2021-06-27 at 10 27 30 AM

readline.c:1905:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
                                    rl_username_completion_function);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    rl_username_completion_function
readline.c:79:42: note: expanded from macro 'rl_username_completion_function'
# define rl_username_completion_function username_completion_function
                                         ^
/opt/homebrew/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
             ^
1 error generated.
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling objspace.c
installing default syslog libraries
linking shared-object syslog.bundle
linking shared-object pty.bundle
compiling date_parse.c
linking shared-object digest.bundle
linking shared-object strscan.bundle
compiling date_strftime.c
installing default pty libraries
installing digest libraries
compiling objspace_dump.c
installing default digest libraries
compiling date_strptime.c
installing default nkf libraries
installing default date_core libraries
linking shared-object objspace.bundle
linking shared-object nkf.bundle
linking shared-object date_core.bundle
make: *** [build-ext] Error 2
+__rvm_make:0> return 2

michaelsmith-st avatar Jun 28 '21 01:06 michaelsmith-st

I had similar issues. I tried all the possible steps to fix the compilation issues but it was not until I updated xcode on MacOS Big Sur that it succeeded.

rebase-master avatar Jul 21 '21 03:07 rebase-master

I had similar issues. I tried all the possible steps to fix the compilation issues but it was not until I updated xcode on MacOS Big Sur that it succeeded.

I installed Xcode and it worked for me too! No more rvm errors.

MissyDyan avatar Jul 21 '21 21:07 MissyDyan

I run this command "rvm install 2.6.6 --with-out-ext=fiddle" but after installation rvm list shows broken. Screen Shot 2021-08-03 at 10 26 29 AM

hardik-snpwr avatar Aug 03 '21 15:08 hardik-snpwr

@steady-daddy and @MissyDyan what exactly did you do after installing xcode? I installed xcode and ran rvm reinstall ruby-2.3.4 and still getting the same error. I also tried everything in this thread before installing xcode but nothing worked. I am on Mac OS 11.5.1

namratasaun avatar Aug 04 '21 12:08 namratasaun

@steady-daddy and @MissyDyan what exactly did you do after installing xcode? I installed xcode and ran rvm reinstall ruby-2.3.4 and still getting the same error. I also tried everything in this thread before installing xcode but nothing worked. I am on Mac OS 11.5.1

For users on Mac (I am on 11.2) with M1, Big Sur (this is what I did - what I needed for my school): install Xcode (update it if you already have it) -- I had to install Xcode; https://apps.apple.com/us/app/xcode/id497799835?mt=12

then run validation in the terminal to see what failed: curl -so- https://raw.githubusercontent.com/learn-co-curriculum/flatiron-manual-setup-validator/master/manual-setup-check.sh | bash 2> /dev/null

Then can install in the terminal (I had to install 2.6.1, try replacing 2.6.1 with 2.3.4 to see if it works for you): rvm install 2.6.1 rvm docs generate-ri. <-- read what it states in the terminal, this was needed for me after it ran rvm --default use 2.6.1 rvm list (to verify)

I had to reinstall (these failed for me): gem update --system (just in case) gem install nokogiri gem install learn-co

For other failed items: https://github.com/learn-co-curriculum/environment-mac-os-catalina-setup

Hope it helps.

MissyDyan avatar Aug 04 '21 14:08 MissyDyan

Thank you for your reply @MissyDyan . I tried rvm install 2.3.4 after re-installing xcode and it fails. So I do not proceed further. The error is for openssl, even tho I am giving it the path to open ssl directory

namratasaun avatar Aug 05 '21 05:08 namratasaun

Thank you for your reply @MissyDyan . I tried rvm install 2.3.4 after re-installing xcode and it fails. So I do not proceed further. The error is for openssl, even tho I am giving it the path to open ssl directory

Rosetta? Did you duplicate your terminal? The duplicate terminal - open using Rosetta (right click "Get Info", click "Open using Rosetta")? Use the duplicate terminal for your work.

MissyDyan avatar Aug 05 '21 05:08 MissyDyan

The solutions above did not work on my case. rvm install "ruby-2.6.3" --with-out-ext=fiddle did.

this worked for me. it actually failed during compilation so i had to add export optflags="-w" to skip compilation time errors

0x2C6 avatar Aug 05 '21 09:08 0x2C6

For people trying to install older versions of Ruby (< 2.3) on arm64, this might help!

3minus1 avatar Aug 06 '21 08:08 3minus1

In my case, I had to reinstall Homebrew after opening the Terminal with Rosetta. I installed Homebrew, RVM, and 2.7.2 Ruby version without Rosetta at first, which led me to some issues afterwards.

Here is how I did:

  1. Right clic Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.

  2. Uninstall Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
  1. Reinstall Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  1. Restart terminal

  2. Check Homebrew is working fine: brew doctor

  3. Reinstall openssl: brew install openssl

  4. Install Ruby: rvm install 2.7

Tulleb avatar Aug 16 '21 14:08 Tulleb

In my case, I had to reinstall Homebrew after opening the Terminal with Rosetta. I installed Homebrew, RVM, and 2.7.2 Ruby version without Rosetta at first, which led me to some issues afterwards.

Here is how I did:

  1. Right clic Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.
  2. Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
  1. Reinstall Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  1. Restart terminal
  2. Check Homebrew is working fine: brew doctor
  3. Reinstall openssl: brew install openssl
  4. Install Ruby: rvm install 2.7

this was really helpful.. I was able to install ruby after following these steps on M1 MBA

vikk2411 avatar Aug 18 '21 12:08 vikk2411

The solutions above did not work on my case. rvm install "ruby-2.6.3" --with-out-ext=fiddle did.

this worked for me. it actually failed during compilation so i had to add export optflags="-w" to skip compilation time errors

This did it for me. Thank you

efe-imo avatar Sep 06 '21 13:09 efe-imo

  1. Right clic Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.
  2. Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
  1. Reinstall Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Restart terminal
  3. Check Homebrew is working fine: brew doctor
  4. Reinstall openssl: brew install openssl
  5. Install Ruby: rvm install 2.7 Or any version

mayur-kambariya avatar Nov 12 '21 10:11 mayur-kambariya

  1. Right clic Terminal from the Application/Utilities folder, Get Info, tick the "Open using Rosetta" box.
  2. Uninstall Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
rm -rf /opt/homebrew/*
sudo rm -rf /opt/homebrew
  1. Reinstall Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Restart terminal
  3. Check Homebrew is working fine: brew doctor
  4. Reinstall openssl: brew install openssl
  5. Install Ruby: rvm install 2.7 Or any version

Copy pasta boy 😅

Tulleb avatar Nov 12 '21 16:11 Tulleb

For me this works https://github.com/rvm/rvm/issues/5033#issuecomment-760815125

rodrigotoledo avatar Nov 23 '21 21:11 rodrigotoledo