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
installing older Ruby versions on OSX after XCode 12 #1489
Comments
Re: This could also affect building some gems that use C code. I can say this already affects the mysql2 gem.... |
Thank you @eddroid for taking the time to write this up, I tried a lot of options and this was the only one that solved for me. |
Thanks for the solution! |
I pinned this to top of issue pages. |
Not sure why discussion of installing 2.6.7 is closed. I am having issues installing it via |
@normanrs ruby-install is a different project than ours: https://github.com/postmodern/ruby-install |
This comment has been minimized.
This comment has been minimized.
To install rvm try these commands in order:
|
@YudaiImazu I can't tell if your error is related to this issue. Your log only shows warnings and notes. Upload the full log into a public gist (or something like that). It's unclear if you set the CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.3.2 |
This comment has been minimized.
This comment has been minimized.
@eddroid @krsinghshubham Above is my log. Your reply would be appreciated. |
Please move your log output to a gist. While logged-in to GitHub, visit https://gist.github.com/ and paste your log output into there. Save it as a public gist. Then update your comment to link to your log instead of pasting the contents into a comment. Your error isn't related to this issue. Searching for "error:", it seems to be related to X11, which is probably a problem with your version of XCode. You should create a new issue for that. |
Today I had a similar issue on my MacBook Pro.
After trial and error, the following worked.
I hope this will help somebody. |
Could an admin please delete the comment at #1489 (comment) -- it makes this issue very hard to read to the bottom, and this issue is kind of important to be easily readable, it seems to be affecting a lot of people trying to use ruby-build on latest XCode/MacOS? (I don't really understand why the issue is closed) @YudaiImazu it is rude to paste in that many lines to a github issue comment. |
None of the above solutions worked for me. I met this issue on Mac Big Sur when trying to install Ruby 2.6.5. The error log shows error messages like this
I suspected the Clang compiler was the issue but I could not found any solution on the internet. In the end, I could fix this issue by doing the following steps:
Brew would not automatically link this gcc because it's conflicting with the default c++ path. You would see something like this
I decided to force the link and overwrite all conflicting files (hopefully it won't affect other parts in your system, BE careful when doing this):
I also created a symlink to the new gcc
Then I run the command
And finally I got Ruby 2.6.5 installed as expected. Hopefully it could help people with similar issue like me. |
getting this error I have MacOS 11.5.1 |
closes: https://trac.macports.org/ticket/62500 see: rbenv/ruby-build#1489 conftest from ext/openssl/extconf.rb runs without including <openssl/*.h>. this leads conflicts between ext/openssl/extconf.h and ext/openssl/*.[hc] under "-Werror=implicit-function-declaration", default with recent Xcode. ext/openssl/mkmf.log: {{{ have_func: checking for HMAC_CTX_copy()... -------------------- yes #### <= returns "no" under -Werror=implicit-function-declaration "/usr/bin/clang -o conftest -I../../.ext/include/x86_64-darwin20 -I../.././include -I../.././ext/openssl -I/opt/local/include/openssl-1.0 -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -pipe -Os -Wno-error=implicit-function-declaration -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -fno-common conftest.c -L/opt/local/lib/openssl-1.0 -L/opt/local/lib -L. -L../.. -L. -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -fstack-protector -L/opt/local/lib -L/opt/local/lib -arch x86_64 -lssl -lcrypto -lruby.2.2.0-static -framework CoreFoundation -lssl -lcrypto -lpthread -ldl -lobjc " conftest.c:13:57: error: use of undeclared identifier 'HMAC_CTX_copy' int t(void) { void ((*volatile p)()); p = (void ((*)()))HMAC_CTX_copy; return 0; } ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ^ 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" #### <= includes only ruby.h 2:- 3: /*top*/ 4: extern int t(void); 5: int main(int argc, char **argv) 6: { 7: if (argc > 1000000) { 8: printf("%p", &t); 9: } 10:- 11: return 0; 12: } 13: int t(void) { void ((*volatile p)()); p = (void ((*)()))HMAC_CTX_copy; return 0; } /* end */ }}}
this may help someone as I had the same issue and the solution was using a version of bison at 2.7. |
My colleague helped me solving this problem with script below: #!/usr/bin/env bash
set -e
# ruby-install --latest
OPENSSL_VERSION=1.1
OPENSSL_DIR=/usr/local/opt/openssl@${OPENSSL_VERSION}
function install-ruby-on-mac() {
PKG_CONFIG_PATH=${OPENSSL_DIR}/lib/pkgconfig \
ruby-install $(ruby-install-options $1) \
ruby $1 \
-- \
--with-openssl-dir=${OPENSSL_DIR} \
--with-opt-dir=$(brew --prefix readline) \
--without-tcl --without-tk
}
install-ruby-on-mac 2.5.8
install-ruby-on-mac 2.6.8
install-ruby-on-mac 2.7.4 Hope it could help someone. |
This helped solved my issue installing ruby 2.7.3 after upgrading from Catalina to Big Sur. Thanks! |
Am trying to install Ruby 2.6.7 in mac os using command `Inspect or clean up the working tree at /var/folders/p8/201hwbjx705fb0by88b64p0r0000gn/T/ruby-build.20230830182044.29712.aSTvUf Last 10 log lines: |
tldr: This is an installation problem and solution. Maybe ya'll can do something about this in
ruby-build
itself? Maybe not. In any case, it's here for the search bots.Problem
output
end of logfile output
sample line from openssl extension MakeMakefile log:
Solution
$ CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.1.7
output:
Explanation
XCode 12 was released September 16, 2020. Apple changed the default
CFLAGS
forclang
.This change prevents this version of Ruby (and possibly others) from compiling native extensions like
openssl
andzlib
. Unfortunately, those errors only appear in the correspondingmkmf.log
for the extensions.This could also affect building some gems that use C code.
The text was updated successfully, but these errors were encountered: