ruby-build: gcc does not support "-Wno-error=shorten-64-to-32"

ruby-build script contains following workaround for clang:

# Work around warnings building Ruby 2.0 on Clang 2.x
if type clang &>/dev/null; then
  if "${CC:-clang}" -x c /dev/null -E -Wno-error=shorten-64-to-32 &>/dev/null; then
    RUBY_CFLAGS="$RUBY_CFLAGS -Wno-error=shorten-64-to-32"
  fi
fi

If both gcc and clang installed and cc is gcc, the above workaround will be triggered wrongly and result in failing to compile anything:

configure:3741: checking whether the C compiler works
configure:3763: gcc   -Wno-error=shorten-64-to-32 -I'/home/quark/.rbenv/versions/2.0.0-p0/include'  -L'/home/quark/.rbenv/versions/2.0.0-p0/lib'  conftest.c  >&5
cc1: error: -Werror=shorten-64-to-32: no option -Wshorten-64-to-32
configure:3767: $? = 1
configure:3805: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define CANONICALIZATION_FOR_MATHN 1
| #define RUBY_BASE_NAME "ruby" !<verconf>!
| #define RUBY_VERSION_NAME RUBY_BASE_NAME"-"RUBY_LIB_VERSION !<verconf>!
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3810: error: in `/tmp/ruby-build.20130310154119.10022/ruby-2.0.0-p0':
configure:3812: error: C compiler cannot create executables
See `config.log' for more details

How about changing ${CC:-clang} to ${CC:-cc} in the workaround script?

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 19 (4 by maintainers)

Commits related to this issue

Most upvoted comments

@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 If I loaded /usr/local/bin first, that’s when all would fail.

~ % g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
~ % gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
~ % clang -v
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
~ % which gcc
/usr/bin/gcc
~ % which g++
/usr/bin/g++
~ % which clang
/usr/bin/clang
~ % which cc
/usr/bin/cc

Not sure if that helps but hopefully it sheds some kind of light.