-
Notifications
You must be signed in to change notification settings - Fork 785
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
gcc does not support "-Wno-error=shorten-64-to-32" #325
Comments
You don't even need to have clang installed to get the problem. I hit it on Debian Stable with only GCC installed, so somehow the "type clang" stuff is being triggered even when the compiler is GCC. Nasty. |
In short, this is a clang-specific flag; it should only be added if clang is the compiler being used, not universally. This check should be done after we know which compiler is being used. |
I was just hit by this and spent about 6 hours uninstalling and reinstalling my toolchain because I thought that was the problem. I am an idiot :( |
This is duplicated with #319. |
The previous version of this logic was causing us to pass the flag when * clang is on the PATH, and * $CC, or 'clang' if CC unset, accepts the flag. But this is totally wrong if we have clang installed, haven't set $CC, and are going to end up using gcc. We end up passing the flag to gcc, which rejects it. The real fix is to put this in the autoconf goo in MRI upstream -- the only correct way to decide whether to pass this flag is after we know exactly what compiler we're using and can test if that compiler accepts the flag. But we can do better than before by approximating autoconf's choice of compiler as $CC if set, 'cc' otherwise (which will typically be a symlink to gcc or clang or another.) Fixes: rbenv#325
The previous version of this logic was causing us to pass the flag when * clang is on the PATH, and * $CC, or 'clang' if CC unset, accepts the flag. But this is totally wrong if we have clang installed, haven't set $CC, and are going to end up using gcc. We end up passing the flag to gcc, which rejects it. The real fix is to put this in the autoconf goo in MRI upstream -- the only correct way to decide whether to pass this flag is after we know exactly what compiler we're using and can test if that compiler accepts the flag. But we can do better than before by approximating autoconf's choice of compiler as $CC if set, 'cc' otherwise (which will typically be a symlink to gcc or clang or another.) Fixes: rbenv#319 and rbenv#325, which is a dupe.
Fixed by #339 |
I am still getting this issue. When I bundle install nokogiri fails to install. My mkmf.log file looks like: |
@stantona: Compiling Nokogiri is different than compiling Ruby. This project only deals with producing working Ruby installations. For compiling Nokogiri please see its troubleshooting docs to see if there are extra steps to install the gem on your system. |
Still seeing this issue trying to build 1.9.3 on Yosemite. The check in the ruby-build script assumes that the compiler used will be either |
1.9.3 is EOL in March, just FYI. If you're still building it for some reason, you might want to stop. |
Thanks, Ipar. Unfortunately, I still have to support systems that still depend on Ruby 1.9 (and break on 2.x), so it's convenient to be able to use rbenv to switch to 1.9 locally on my Mac as well. (We have a team working on replacing these systems and updating the things that depend on them, but can't spend too many resources on that effort, so it's going slowly, and meanwhile we still have to keep them running.) |
@lpar this happens with newer versions like 2.2.0-preview1 as well. $CC is not set, both clang && gcc are installed, the latter one is linked to clang. Ruby's ./configure seems to pick up gcc (explained by @gnprice right here #319 (comment)), while ruby-build sets that CFLAG. Result:
Workaround is to explicitly set A solution might be that ruby-build exports CC to a known value, like it does when you use |
Turns out this is a known issue tracked in #651, which happens if you have apple-gcc4.2 installed as well on Yosemite. |
Despite this issue is a year old I had to do this patch manually a month ago.
|
@Nakilon That's strange. This is what ruby-build has right now: if "${CC:-cc}" -x c /dev/null -E -Wno-error=shorten-64-to-32 &>/dev/null; then
RUBY_CFLAGS="-O3 -Wno-error=shorten-64-to-32 $RUBY_CFLAGS"
fi What state was your file in, and what did you have to remove? |
I'm now having this issue, bundle install fails.
and
|
@lacostenycoder did you find a solution for the unf_ext compilation error? |
I'm on FreeBSD and I have the same issue when I have gcc and clang installed at the same time. The default compiler is clang. Even explicitly setting CC to clang gives the same results:
config.log shows the configure script recognizes clang and g++ at the same time. I'm not sure why the configure script mix up compilers. Removing gcc fixed that though. |
@glaszig @NuLL3rr0r I'm on Mac OSX with Homebrew. My solution was centered around my $PATH variable to use my system defaults loading /usr/bin/* first
Not sure if that helps but hopefully it sheds some kind of light. |
@lacostenycoder thank you so much for the info. I'll try that next time to see what happens. Thank you. |
ruby-build script contains following workaround for clang:
If both gcc and clang installed and
cc
isgcc
, the above workaround will be triggered wrongly and result in failing to compile anything:How about changing
${CC:-clang}
to${CC:-cc}
in the workaround script?The text was updated successfully, but these errors were encountered: