alopez02
alopez02

Reputation: 1524

Error while running configure when installing Ruby via RVM `C compiler cannot create executables`

For whatever reason, I've just imploded my RVM (which was working just fine) and tried it to install it again. I'm facing an error that prevents the installation while RVM is testing the compiler. I'd appreciate any help debugging this.

The issue occurs after running:

$ rvm install 2.6.2

of any other version of Ruby.

I get the following output

Error running './configure --prefix=/Users/andres/.rvm/rubies/ruby-

2.6.2  --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/[email protected] --disable-install-doc --enable-shared',
    please read /Users/andres/.rvm/log/1554329766_ruby-2.6.2/configure.log
    There has been an error while running configure. Halting the installation.

And the configure.log shows

[2019-04-04 09:07:04] ./configure
current path: /Users/andres/.rvm/src/ruby-2.6.0
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/usr/local/opt/node@8/bin:/usr/local/opt/node@8/bin:/opt/local/bin:/opt/local/sbin:/Users/andres/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/node@8/bin:/opt/local/bin:/opt/local/sbin:/Users/andres/bin:/Users/andres/.rvm/bin
command(5): ./configure --prefix=/Users/andres/.rvm/rubies/ruby-2.6.0 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/[email protected] --disable-install-doc --enable-shared
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... x86_64-apple-darwin18.5.0
checking host system type... x86_64-apple-darwin18.5.0
checking target system type... x86_64-apple-darwin18.5.0
checking whether the C compiler works... no
configure: error: in `/Users/andres/.rvm/src/ruby-2.6.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

Relevant config.log lines

## ----------- ##
## Core tests. ##
## ----------- ##

configure:2996: checking for ruby
configure:3014: found /usr/bin/ruby
configure:3027: result: /usr/bin/ruby
configure:3105: checking build system type
configure:3119: result: x86_64-apple-darwin18.5.0
configure:3207: checking host system type
configure:3220: result: x86_64-apple-darwin18.5.0
configure:3240: checking target system type
configure:3253: result: x86_64-apple-darwin18.5.0
configure:3905: checking for C compiler version
configure:3914: gcc --version >&5
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
configure:3925: $? = 0
configure:3914: gcc -v >&5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3925: $? = 0
configure:3914: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3925: $? = 1
configure:3914: gcc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:3925: $? = 1
configure:3945: checking whether the C compiler works
configure:3967: gcc    conftest.c  >&5
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd:4:18: error: unknown enumerated scalar
platform:        zippered
                 ^~~~~~~~
 file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3971: $? = 1
configure:4009: 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 ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:4014: error: in `/Users/andres/.rvm/src/ruby-2.6.0':
configure:4016: error: C compiler cannot create executables
See `config.log' for more details

Environment:

I've tried (1) reinstalling RVM again and again. (2) Running rvm get stable --autolibs=enable --auto-dotfiles to fix any problems with bash, etc. (3) Making sure Xcode is updated. (4) Running rvm install 2.6.2 --with-gcc=clang (as suggested in some SO answers).

All these without success. I'd appreciate your help.

--- ADDITIONAL INFO ---

gem env output

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2.3
  - RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
  - USER INSTALLATION DIRECTORY: /Users/andres/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /Users/andres/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-18
  - GEM PATHS:
     - /Library/Ruby/Gems/2.3.0
     - /Users/andres/.gem/ruby/2.3.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/opt/node@8/bin
     - /usr/local/opt/node@8/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /Users/andres/bin
     - /usr/local/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/opt/node@8/bin
     - /opt/local/bin
     - /opt/local/sbin
     - /Users/andres/bin
     - /Users/andres/.rvm/bin
     - /Users/andres/.rvm/bin
     - /Users/andres/.rvm/bin

Upvotes: 3

Views: 7072

Answers (1)

Joel K
Joel K

Reputation: 131

I think your xcode version is out of date. Upgrading to 10.2 should fix it.

Upvotes: 6

Related Questions