Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Installing Ruby on MacOS 12.2 (or 11.6) produces compilation errors in the downloaded source; how do I fix?

+5
−0

A project I want to work on requires Ruby. I was directed to RVM or rbenv. I tried rbenv first because it has Mac instructions, ran into failures, uninstalled it and installed RVM, and still ran into problems. I am not sure how to debug. Details:

I am on MacOS 12.2 (was 11.6 when I first asked this). I am using the terminal (bash command line). I'll jump to the problem with RVM because the developer I'm working with uses it.

I installed RVM using the following command (from their documentation):

\curl -sSL https://get.rvm.io | bash -s stable

That did not produce any error messages. This installation modified my .bash_profile, so I fired up a new shell. In it I used rvm list known and confirmed that the list includes [ruby-]2.6[.6], the version my project needs. I then typed:

rvm install "ruby-2.6.6"

Which produced a compilation error (substituting USER for my actual user name in paths):

Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/USER/.rvm/rubies/ruby-2.6.6, this may take a while depending on your cpu(s)...
ruby-2.6.6 - #downloading ruby-2.6.6, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.4M  100 13.4M    0     0  7961k      0  0:00:01  0:00:01 --:--:-- 7957k
ruby-2.6.6 - #extracting ruby-2.6.6 to /Users/USER/.rvm/src/ruby-2.6.6.....
ruby-2.6.6 - #configuring......................................................|
ruby-2.6.6 - #post-configuration.
ruby-2.6.6 - #compiling...................................................
Error running '__rvm_make -j8',
please read /Users/USER/.rvm/log/1637706281_ruby-2.6.6/make.log
There has been an error while running make. Halting the installation.

I consulted the log file given at the end and found a puzzling error, which I included in an earlier version of this question (you can find it in the revision history). People suggested that I needed to reinstall homebrew because I was now running on the M1 chip. I've done that and repeated the steps to install Ruby, and this time I get a different make error:

installing default libraries
closure.c:264:14: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    result = ffi_prep_closure(pcl, cif, callback, (void *)self);
             ^
6 warnings and 1 error generated.
make[2]: *** [closure.o] Error 1

My attempt to install using rbenv ended with a very similar error, so switching from RVM to rbenv won't solve my problem.

How can I remedy this problem? I'm wondering if these Ruby managers require something in my environment that I'm missing, despite the output saying that dependencies were checked. Maybe it's assuming a different compiler than whatever I have? I see the reference to C99 there but don't know what it might be expecting.

This error isn't coming from my code; it's coming from the Ruby source code that RVM downloaded and tried to build. I guess I could try debugging that code, if I knew anything about it, but that seems like the wrong approach. I'm trying to get the "official" Ruby 2.6.6 to run, not my locally-hacked Ruby 2.6.6.

I don't know Ruby or its environment; I'm hoping to learn as I work on this project. Because of that lack of experience, though, I don't know where to look next or how to debug this problem. How do I successfully install this version of Ruby?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

2 comment threads

Check readline version and version requirements (3 comments)
A related bug report (2 comments)

1 answer

+0
−0

Wait a minute I think you missed something, yesterday when I read your message in Discord I thought you were unable to install RVM which were producing that error. But this question clears my confusion. You were executing rvm install "ruby-2.6.6" but that's not what we used to do.

I had written the same answer in another question of "mine". here it is (I had mentioned it in Discord either) (I don't have any idea if it's really good to link my old answer which account I had deleted, if it's bad purpose then you can edit or suggest edit). You should have execute

rvm install 2.6.6    #this will install 2.6.6 version of Ruby
rvm use 2.6.6        #you must execute it otherwise you will keep using earlier version (whichever you had in your system)

Sometimes, they don't work without being super user. So I used to use sudo but it sometimes doesn't work also. For that reason you should execute

/bin/bash --login       #I don't have idea, if the command really works in Mac

/bin/bash --login is nearly related to su -.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Didn't work. (3 comments)

Sign up to answer this question »