Closed
Description
I've managed to install 2.7.2 and 3.0.0, but 2.6.6 fails with the following error
compiling closure.c
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);
^
1 error generated.
Reacted by Tiago Santos, Amine Bensalah, redundantautomata, gwalshington, cindyliu923, Londerson and Chris Raastad
Metadata
Metadata
Assignees
Labels
No labels
Activity
hsbt commentedon Dec 28, 2020
It's known issue. Ruby 2.6 didn't support M1 macOS yet.
If you want to use Ruby 2.6 with M1 macOS, Can you file it to https://bugs.ruby-lang.org/? Thanks.
nelseric commentedon Dec 28, 2020
Thanks for pointing me in the right direction.
mrkn commentedon Dec 28, 2020
@nelseric I guess the error is only due to fiddle. Probably, you can install Ruby 2.6 with specifying
--with-out-ext=fiddlein the configure option.nelseric commentedon Dec 28, 2020
@mrkn Thanks, that worked
rience commentedon Dec 29, 2020
I was also able to install Ruby 2.6.6 with this
santostiago commentedon Jan 18, 2021
I ended up doing this:
export optflags="-Wno-error=implicit-function-declaration"; export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"; export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"; export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig" | rbenv install 2.5.5SalvatoreT commentedon Feb 2, 2021
@santostiago, that worked for me. Thank you!
ak15 commentedon Feb 5, 2021
This worked for me in My Apple M1 - Please try this if you are facing issue (I tried for ruby v 2.6.0) and don't need rosetta too
@santostiago
Once again thanks worked with 2.6.6
HundredBillion commentedon Feb 8, 2021
THIS WORKED FOR ME
I spent 3hrs trying to get ruby 2.6.2 installed on my M1.
These 3 lines of code worked for me. Just make sure to change the version number to 2.6.2 (if that is what you need)
edmangimelli commentedon Feb 23, 2021
thank you so much @santostiago 😭
this actually solved my
asdfinstall problem: (fish shell)Add configuration for Ruby
jujudellago commentedon Apr 18, 2021
more thanks for you @santostiago !!! you saved my day !!
endless ffi errors
/Users/juju/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/ffi-1.9.18/lib/ffi/types.rb:69:infind_type': unable to resolve type 'size_t' (TypeError)`olivierlacan commentedon May 6, 2021
@jujudellago Did you try to update the ffi gem? Or uninstall and reinstall it with the same flags shown above prefixed before you run bundle install? Bundler accepts build flags configuration it can store for specific gems. See: https://bundler.io/v1.16/bundle_config.html#BUILD-OPTIONS
jujudellago commentedon May 6, 2021
Oh, so actually my error was just related to my project, I had a hardcoded version of ffi in my gemfile
To figure this out I just made an empty rails app, saw everything was fine, and realized I had the wrong ffi in gemfile.lock
With other compatibility issues I ended up using ruby 2.7.2
soheil commentedon Jun 4, 2021
rvm install 2.6.6 --with-out-ext=fiddleworks great.olivierlacan commentedon Jun 5, 2021
I’m sorry the flag is
--with-out-ext?Seriously?
Not
--without-ext, but--with-out-ext? 😳Can we please fix that if it wasn’t a typo on your side? Seems bad.
tf-rshearer commentedon Jun 21, 2021
rvm install 2.6.6 --with-out-ext=fiddleWorked for me on Big Sur 11.4 w/ m1. Thanks!michaelsmith-st commentedon Jun 28, 2021
RVM is much more fussy on the installation process (pgp keys, openSSL installation). And after all that,
rvm install 2.6.6 --with-out-ext=fiddledid not work for me on Big Sur 11.4 w/ M1.The combination of
exportcommands withrbenv install 2.6.6above worked great. Plus the dependency installation is soooo much smoother.I use RVM on my Intel Mac...but I'm inclined to switch to rbenv now. (My use case is simple, so I skipped the
rbenv-gem-rehashandgem installparts).https://thoughtbot.com/blog/using-rbenv-to-manage-rubies-and-gems
bgm commentedon Jul 4, 2021
@michaelsmith-st Were you able to get Ruby 2.6.6 to install via RVM in the end? I haven't had any luck so far, and pretty much every answer pointing to its installation through the use of flags and so on ends up as a [broken] install for me.
etipton commentedon Sep 16, 2021
Just wanted to chime in and confirm that this is safe to do... I didn't really understand what this would actually do so I dug in a bit... wanted to be sure this wouldn't cause unexpected issues down the line*
To cut to the chase...
You can see here that by setting the USE_FFI_CLOSURE_ALLOC macro, the offending function (ffi_prep_closure) is never referenced.
And to confirm that the macro makes sense (the ffi_closure_alloc function is indeed available):
*In hindsight, I guess that's what compilation is for in the first place, lol
yeukfei02 commentedon Oct 4, 2021
encounter same problem in macbook m1
I tried this I am able to install ruby 2.6.5, not sure if this
rvm install 2.6.5 --with-out-ext=fiddlealso work in m1just to share to let others know
Update Ruby version
Update Ruby version (#176)
genezys commentedon Dec 21, 2021
Thanks for all the comments. Here is the exact commands I used to install 2.6.7 using rbenv on an M1 Pro:
I hope this multi-line version will be more readable to others.
Based on previous comments, it should work for RVM too.
rimian commentedon Mar 1, 2022
This worked with chruby and 2.6.5 for me. Thanks!