编译器无法生成可执行文件。 (RuntimeError)

时间:2012-11-07 23:07:23

标签: ruby-on-rails ruby xcode rubygems

我最近升级到OS Mountain Lion。我正在处理的项目需要gem sys-proctable作为依赖项,但是当我运行bundle install时,我得到:

Fetching gem metadata from https://rubygems.org/.........
.
.
.
Installing sys-proctable (0.9.2) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for rb_pid_t in ruby.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1022:in `try_type'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1050:in `block in have_type'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1049:in `have_type'
    from extconf.rb:3:in `<main>'


Gem files will remain installed in /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/sys-proctable-0.9.2-universal-darwin for inspection.
Results logged to /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/sys-proctable-0.9.2-universal-darwin/ext/darwin/gem_make.out
An error occurred while installing sys-proctable (0.9.2), and Bundler cannot continue.
Make sure that `gem install sys-proctable -v '0.9.2'` succeeds before bundling.

但我确实安装了开发人员工具!运行gem install sys-proctable -v '0.9.2'给出了几乎相同的错误:

Building native extensions.  This could take a while...
ERROR:  Error installing sys-proctable:
    ERROR: Failed to build gem native extension.

        /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_pid_t in ruby.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1022:in `try_type'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1050:in `block in have_type'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1049:in `have_type'
    from extconf.rb:3:in `<main>'


Gem files will remain installed in /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/sys-proctable-0.9.2-universal-darwin for inspection.
Results logged to /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/sys-proctable-0.9.2-universal-darwin/ext/darwin/gem_make.out
[sample_app(filling-in-layout)]$ /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
                                                                              A [sample_app(filling-in-layout)]$ gem install sys-proctable -v '0.9.2'
Building native extensions.  This could take a while...
ERROR:  Error installing sys-proctable:
    ERROR: Failed to build gem native extension.

        /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_pid_t in ruby.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1022:in `try_type'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1050:in `block in have_type'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:1049:in `have_type'
    from extconf.rb:3:in `<main>'


Gem files will remain installed in /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/sys-proctable-0.9.2-universal-darwin for inspection.
Results logged to /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/sys-proctable-0.9.2-universal-darwin/ext/darwin/gem_make.out

以下是我的mkmf.log文件的内容:

"/usr/bin/gcc-4.2 -o conftest -I/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-darwin11.4.0 -I/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -I/Users/mgriffel/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/opt/sm/pkg/active/include -fno-common -pipe conftest.c  -L. -L/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/lib -L/Users/mgriffel/.rvm/usr/lib -L. -L/opt/sm/pkg/active/lib -L/usr/local/lib     -lruby.1.9.1  -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

现在我最近重新安装了XCode和命令行工具,但是我担心我搞砸了我的C编译器,因为当我尝试运行rvm --force install 1.9.3时,我收到以下错误:

No binary rubies available for: downloads/ruby-1.9.3-p194.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
lipo: can't open input file:  (No such file or directory)
Fetching yaml-0.1.4.tar.gz to /Users/mgriffel/.rvm/archives
Extracting yaml to /Users/mgriffel/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/mgriffel/.rvm/src/yaml-0.1.4.
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include ./configure --prefix=/Users/mgriffel/.rvm/usr', please read /Users/mgriffel/.rvm/log/ruby-1.9.3-p194/yaml/configure.log
Compiling yaml in /Users/mgriffel/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/mgriffel/.rvm/usr
Installing Ruby from source to: /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)...
ruby-1.9.3-p194 - #downloading ruby-1.9.3-p194, this may take a while depending on your connection...
ruby-1.9.3-p194 - #extracted to /Users/mgriffel/.rvm/src/ruby-1.9.3-p194 (already extracted)
Patch cflags was already applied.
ruby-1.9.3-p194 - #configuring
Error running 'env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mgriffel/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194 --with-gcc=clang', please read /Users/mgriffel/.rvm/log/ruby-1.9.3-p194/configure.log
There has been an error while running configure. Halting the installation.

configure.log

的内容
[2012-11-07 18:02:12] env LDFLAGS=-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mgriffel/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194 --with-gcc=clang
checking build system type... x86_64-apple-darwin12.2.0
checking host system type... x86_64-apple-darwin12.2.0
checking target system type... x86_64-apple-darwin12.2.0
checking whether the C compiler works... no
configure: error: in `/Users/mgriffel/.rvm/src/ruby-1.9.3-p194':
configure: error: C compiler cannot create executables
See `config.log' for more details

最后,config.log的内容:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --enable-shared --disable-install-doc --prefix=/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194 --with-gcc=clang

## --------- ##
## Platform. ##
## --------- ##

hostname = Mattans-MacBook-Air.local
uname -m = x86_64
uname -r = 12.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
     Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3
Primary memory available: 4.00 gigabytes
Default processor set: 138 tasks, 703 threads, 4 processors
Load average: 3.07, Mach factor: 1.53
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /Users/mgriffel/.rvm/usr/bin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /usr/local/bin
PATH: /usr/local/sbin
PATH: /usr/local/mysql/bin
PATH: /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/bin
PATH: /Users/mgriffel/.rvm/gems/ruby-1.9.3-p194@global/bin
PATH: /Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194/bin
PATH: /Users/mgriffel/.rvm/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /opt/sm/bin
PATH: /opt/sm/pkg/active/bin
PATH: /opt/sm/pkg/active/sbin


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

configure:2788: checking build system type
configure:2802: result: x86_64-apple-darwin12.2.0
configure:2870: checking host system type
configure:2883: result: x86_64-apple-darwin12.2.0
configure:2903: checking target system type
configure:2916: result: x86_64-apple-darwin12.2.0
configure:3395: checking for C compiler version
configure:3404: clang --version >&5
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
configure:3415: $? = 0
configure:3404: clang -v >&5
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
configure:3415: $? = 0
configure:3404: clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3415: $? = 1
configure:3404: clang -qversion >&5
clang: error: no input files
configure:3415: $? = 1
configure:3435: checking whether the C compiler works
configure:3457: clang   -L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mgriffel/.rvm/usr/lib conftest.c  >&5
clang: error: no such file or directory: 'CFLAGS=-I/opt/sm/pkg/active/include'
clang: error: no such file or directory: 'CPATH=/opt/sm/pkg/active/include'
configure:3461: $? = 1
configure:3499: 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
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3504: error: in `/Users/mgriffel/.rvm/src/ruby-1.9.3-p194':
configure:3506: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-apple-darwin12.2.0
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mgriffel/.rvm/usr/lib'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-apple-darwin12.2.0
ac_cv_prog_CC=clang
ac_cv_target=x86_64-apple-darwin12.2.0

## ----------------- ##
## Output variables. ##
## ----------------- ##

ALLOCA=''
AR=''
ARCHFILE=''
ARCH_FLAG=''
AS=''
ASFLAGS=''
BASERUBY='ruby'
BUILTIN_ENCOBJS=''
BUILTIN_TRANSOBJS=''
BUILTIN_TRANSSRCS=''
CAPITARGET=''
CC='clang'
CCDLFLAGS=''
CFLAGS=''
CHDIR=''
COMMON_HEADERS=''
COMMON_LIBS=''
COMMON_MACROS=''
COUTFLAG=''
CP=''
CPP=''
CPPFLAGS=''
CPPOUTFILE=''
CXX=''
CXXFLAGS=''
DEFS=''
DLDFLAGS=''
DLDLIBS=''
DLEXT2=''
DLEXT=''
DLLWRAP=''
DOT=''
DOXYGEN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_SHARED=''
EXECUTABLE_EXTS=''
EXEEXT=''
EXPORT_PREFIX=''
EXTOUT=''
EXTSTATIC=''
GCC=''
GNU_LD=''
GREP=''
INSTALLDOC=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LDFLAGS='-L/opt/sm/pkg/active/lib CFLAGS=-I/opt/sm/pkg/active/include CPATH=/opt/sm/pkg/active/include -L/Users/mgriffel/.rvm/usr/lib'
LDSHARED=''
LDSHAREDXX=''
LIBEXT=''
LIBOBJS=''
LIBPATHENV=''
LIBPATHFLAG=''
LIBRUBY=''
LIBRUBYARG=''
LIBRUBYARG_SHARED=''
LIBRUBYARG_STATIC=''
LIBRUBY_A=''
LIBRUBY_ALIASES=''
LIBRUBY_DLDFLAGS=''
LIBRUBY_LDSHARED=''
LIBRUBY_RELATIVE=''
LIBRUBY_SO=''
LIBS=''
LINK_SO=''
LN_S=''
LTLIBOBJS=''
MAINLIBS=''
MAJOR='1'
MAKEDIRS=''
MAKEFILES=''
MANTYPE=''
MINIOBJS=''
MINIRUBY=''
MINOR='9'
MKDIR_P=''
NM=''
NROFF=''
NULLCMD=''
OBJCOPY=''
OBJDUMP=''
OBJEXT=''
OUTFLAG=''
PACKAGE=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PKG_CONFIG=''
PREP=''
RANLIB=''
RDOCTARGET=''
RI_BASE_NAME=''
RM=''
RMALL=''
RMDIR=''
RMDIRS=''
RPATHFLAG=''
RUBYW_BASE_NAME='rubyw'
RUBYW_INSTALL_NAME=''
RUBY_BASE_NAME='ruby'
RUBY_INSTALL_NAME=''
RUBY_PROGRAM_VERSION='1.9.3'
RUBY_RELEASE_DATE='2012-04-20'
RUBY_SO_NAME=''
RUNRUBY=''
SET_MAKE=''
SHELL='/bin/sh'
SOLIBS=''
STATIC=''
STRIP=''
SYMBOL_PREFIX=''
TEENY='1'
TEST_RUNNABLE=''
THREAD_MODEL=''
TRY_LINK=''
UNIVERSAL_ARCHNAMES=''
UNIVERSAL_INTS=''
USE_RUBYGEMS=''
WERRORFLAG=''
WINDRES=''
XCFLAGS=''
XLDFLAGS=''
XRUBY=''
XRUBY_LIBDIR=''
XRUBY_RUBYHDRDIR=''
XRUBY_RUBYLIBDIR=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_OBJCOPY=''
ac_ct_OBJDUMP=''
arch=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin12.2.0'
build_alias=''
build_cpu='x86_64'
build_os='darwin12.2.0'
build_vendor='apple'
cflags=' ${optflags} ${debugflags} ${warnflags}'
configure_args=''
cppflags=''
cxxflags=' ${optflags} ${debugflags} ${warnflags}'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
debugflags=''
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec=''
exec_prefix='NONE'
host='x86_64-apple-darwin12.2.0'
host_alias=''
host_cpu='x86_64'
host_os='darwin12.2.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
optflags=''
pdfdir='${docdir}'
prefix='/Users/mgriffel/.rvm/rubies/ruby-1.9.3-p194'
program_transform_name='s&^&&'
psdir='${docdir}'
ridir=''
ruby_pc=''
ruby_version=''
rubyhdrdir=''
rubylibprefix=''
rubyw_install_name=''
sbindir='${exec_prefix}/sbin'
setup=''
sharedstatedir='${prefix}/com'
sitearch=''
sitedir=''
sitehdrdir=''
sysconfdir='${prefix}/etc'
target='x86_64-apple-darwin12.2.0'
target_alias=''
target_cpu='x86_64'
target_os='darwin12.2.0'
target_vendor='apple'
try_header=''
vendordir=''
vendorhdrdir=''
warnflags=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* 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

configure: exit 77

10 个答案:

答案 0 :(得分:22)

发生了同样的问题,我终于解决了。 以下是我遵循的步骤:

  • Xcode,Xcode CLT
  • sudo xcodebuild -license
  • sudo port upgrade outdated
  • sudo port install apple-gcc42
  • rvm reinstall 1.9.3 #important!

真的,我认为只需要第一步,第二步和最后一步,但无法测试它。

答案 1 :(得分:15)

确保在更新后打开XCode。我发现在最近通过App Store更新XCode后,我必须打开它并接受新的许可协议。否则我收到“编译器无法生成可执行文件。(RuntimeError)您必须先安装开发工具。”

答案 2 :(得分:12)

如果您使用的是rbenv和自制软件:

brew tap homebrew/dupes ; brew install apple-gcc42

答案 3 :(得分:10)

以下步骤解决了这个问题。

  1. xcode-select install
  2. sudo xcodebuild -license
  3. 希望它有所帮助。

答案 4 :(得分:3)

事实证明这是RailsInstaller OSX 1.0.3中的一个错误 - (在阅读时发现Problems installing Ruby on Mountain Lion - ruby 1.9.3 wont' compile

我需要更改/etc/rvmrc以包含此内容:

umask g+w
export -a rvm_configure_env
rvm_configure_env=('LDFLAGS=-L/opt/sm/pkg/active/lib' 'CFLAGS=-I/opt/sm/pkg/active/include' 'CPATH=/opt/sm/pkg/active/include')

有关详细信息,请参阅:https://github.com/railsinstaller/railsinstaller-nix/issues/10

答案 5 :(得分:1)

我在“捆绑安装”期间遇到以下错误:


Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/bob/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
creating Makefile

make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1


Gem files will remain installed in /Users/bob/.rvm/gems/ruby-1.9.3-p194@storefront/gems/json-1.8.0 for inspection.
Results logged to /Users/bob/.rvm/gems/ruby-1.9.3-p194@storefront/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.0), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.0'` succeeds before bundling.

更新Xcode并安装CLT后,执行以下操作可以解决问题:

bundle clean --force

bundle install

答案 6 :(得分:1)

因为我相信我会再次降落在这里。

我的问题是sudo xcodebuild -license实际上没有做任何事情,我必须手动启动xcode以同意他们的条款才能使其正常运行。多么光荣的操作系统。

答案 7 :(得分:0)

您必须安装最新的Xcode和命令行工具(在Xcode内)。 它显然是你的Xcode或PATH的东西。 which clang给出了什么?

答案 8 :(得分:0)

当我在Mountain Lion上遇到SAME问题时,我无法重复这一点对我来说是多么令人沮丧。在我读到Mountain Lion存在一些GCC问题后,我最终将我的操作系统升级为Mavericks。我仍然有同样的错误:/

唯一有用的是在安装命令行工具后重新安装ruby。

“对于未来的访问者来说,这对我有用。不是说它应该重要但是我安装了rvm和brew。已经安装了Xcode和Xcode CLT。我只需要(在任何一个都没有sudo)rvm使用2.0.0 ,然后xcode -license,同意许可证然后rvm重新安装2.0.0。最后一步非常重要,确实“

然后$ gem install rails

这完全解决了我的问题。此博客提供了一个很棒的演练,其中有关于如何以多种方式安装Mac开发工具(命令行工具)的截图(http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/

答案 9 :(得分:0)

关于Centos和Fedora。

您必须先安装开发工具。

应与

一起安装
dnf install @development-tools

有关更多信息,请参见此https://stackoverflow.com/a/35303883/9003945