FFI 1.0.11无法安装在cygwin中

时间:2012-08-27 09:59:00

标签: ruby-on-rails cygwin capybara ffi

我无法安装ffi gem并在执行'bundle install'时出现以下错误:

        Installing ffi (1.0.11) with native extensions
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

                    /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/bin/ruby.exe extconf.rb
    checking for ffi.h... no
    checking for ffi.h in /usr/local/include... no
    checking for rb_thread_blocking_region()... yes
    checking for ruby_native_thread_p()... yes
    checking for rb_thread_call_with_gvl()... yes
    creating extconf.h
    creating Makefile

    make
    Configuring libffi
    make -C "/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi"
    make[1]: Entering directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi'
    make "AR_FLAGS="  "CC_FOR_BUILD="  "CFLAGS="  "CXXFLAGS="  "CFLAGS_FOR_BUILD="
    "CFLAGS_FOR_TARGET="  "INSTALL=/usr/bin/install -c"  "INSTALL_DATA=/usr/bin/install -c -m 644"  "INSTALL_PROGRAM=/usr/bin/install -c"  "INSTALL_SCRIPT=/usr/bin/install -c"  "JC1FLAGS="  "LDFLAGS="  "LIBCFLAGS="  "LIBCFLAGS_FOR_TARGET="  "MAKE=make"  "MAKEINFO=/bin/sh /home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/missing --run makeinfo "  "PICFLAG="  "PICFLAG_FOR_TARGET="  "RUNTESTFLAGS="  "SHELL=/bin/sh"  "exec_prefix=/usr/local"  "infodir=/usr/local/share/info"  "libdir=/usr/local/lib"  "prefix=/usr/local"  "AR=ar"  "AS=as"  "CC=gcc"  "CXX=g++"  "LD=/usr/i686-pc-cygwin/bin/ld.exe"  "NM=/usr/bin/nm -B"  "RANLIB=ranlib"  "DESTDIR=" all-recursive
    make[2]: Entering directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi'
    Making all in include
    make[3]: Entering directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/include'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/include'
    Making all in testsuite
    make[3]: Entering directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/testsuite'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/testsuite'
    Making all in man
    make[3]: Entering directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/man'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi/man'
    make[3]: Entering directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi'
    /bin/sh ./libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -Wall -g -fexceptions  -c -o src/debug.lo src/debug.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -g -fexceptions -c src/debug.c  -DDLL_EXPORT -DPIC -o src/.libs/debug.o
    /bin/sh ./libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -Wall -g -fexceptions  -c -o src/prep_cif.lo src/prep_cif.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -g -fexceptions -c src/prep_cif.c  -DDLL_EXPORT -DPIC -o src/.libs/prep_cif.o
    /bin/sh ./libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -Wall -g -fexceptions  -c -o src/types.lo src/types.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -g -fexceptions -c src/types.c  -DDLL_EXPORT -DPIC -o src/.libs/types.o
    /bin/sh ./libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -Wall -g -fexceptions  -c -o src/raw_api.lo src/raw_api.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -g -fexceptions -c src/raw_api.c  -DDLL_EXPORT -DPIC -o src/.libs/raw_api.o
    /bin/sh ./libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -Wall -g -fexceptions  -c -o src/java_raw_api.lo src/java_raw_api.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -g -fexceptions -c src/java_raw_api.c  -DDLL_EXPORT -DPIC -o src/.libs/java_raw_api.o
    /bin/sh ./libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -Wall -g -fexceptions  -c -o src/closures.lo src/closures.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -g -fexceptions -c src/closures.c  -DDLL_EXPORT -DPIC -o src/.libs/closures.o
    /bin/sh ./libtool --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -Wall -g -fexceptions  -c -o src/x86/ffi.lo src/x86/ffi.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -Wall -g -fexceptions -c src/x86/ffi.c  -DDLL_EXPORT -DPIC -o src/x86/.libs/ffi.o
    /bin/sh ./libtool    --mode=compile gcc -DHAVE_CONFIG_H -I.   -I. -I./include -Iinclude -I./src  -I. -I./include -Iinclude -I./src  -c -o src/x86/win32.lo src/x86/win32.S
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include -Iinclude -I./src -I. -I./include -Iinclude -I./src -c src/x86/win32.S  -DDLL_EXPORT -DPIC -o src/x86/.libs/win32.o
    /bin/sh ./libtool --tag=CC    --mode=link gcc -Wall -g -fexceptions   -version-info `grep -v '^#' ./libtool-version` -no-undefined  -o libffi.la -rpath /usr/local/lib src/debug.lo src/prep_cif.lo src/types.lo  src/raw_api.lo src/java_raw_api.lo src/closures.lo      src/x86/ffi.lo src/x86/win32.lo

    libtool: link: gcc -shared  src/.libs/debug.o src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/x86/.libs/ffi.o src/x86/.libs/win32.o      -o .libs/cygffi-5.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libffi.dll.a
    Creating library file: .libs/libffi.dll.a
    libtool: link: ( cd ".libs" && rm -f "libffi.la" && ln -s "../libffi.la" "libffi.la" )
    /bin/sh ./libtool --tag=CC    --mode=link gcc -Wall -g -fexceptions     -o libffi_convenience.la  src/debug.lo src/prep_cif.lo src/types.lo  src/raw_api.lo src/java_raw_api.lo src/closures.lo      src/x86/ffi.lo src/x86/win32.lo

    libtool: link: ar cru .libs/libffi_convenience.a src/.libs/debug.o src/.libs/prep_cif.o src/.libs/types.o src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/x86/.libs/ffi.o src/x86/.libs/win32.o
    libtool: link: ranlib .libs/libffi_convenience.a
    libtool: link: ( cd ".libs" && rm -f "libffi_convenience.la" && ln -s "../libffi_convenience.la" "libffi_convenience.la" )
    make[3]: Leaving directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi'
    make[2]: Leaving directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi'
    make[1]: Leaving directory `/home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/libffi'
    compiling AbstractMemory.c
    AbstractMemory.c:271: warning: 'memory_put_bool' defined but not used
    AbstractMemory.c:271: warning: 'memory_write_bool' defined but not used
    AbstractMemory.c:271: warning: 'memory_get_bool' defined but not used
    AbstractMemory.c:271: warning: 'memory_read_bool' defined but not used
    AbstractMemory.c:271: warning: 'memory_write_array_of_bool' defined but not used
    AbstractMemory.c:271: warning: 'memory_read_array_of_bool' defined but not used
    AbstractMemory.c:388: warning: 'memory_read_array_of_string' defined but not used
    compiling ArrayType.c
    compiling Buffer.c
    compiling Call.c
    compiling ClosurePool.c
    compiling DataConverter.c
    compiling DynamicLibrary.c
    compiling ffi.c
    compiling Function.c
    compiling FunctionInfo.c
    compiling LastError.c
    compiling MappedType.c
    MappedType.c: In function `mapped_initialize':
    MappedType.c:63: warning: unused variable `t'
    compiling MemoryPointer.c
    MemoryPointer.c:134: warning: 'memptr_mark' defined but not used
    compiling MethodHandle.c
    compiling Platform.c
    compiling Pointer.c
    compiling Struct.c
    compiling StructByReference.c
    compiling StructByValue.c
    compiling StructLayout.c
    compiling Thread.c
    In file included from /usr/include/cygwin/sys_time.h:13,
                                     from /usr/include/sys/time.h:28,
                                     from /usr/include/sys/_default_fcntl.h:186,
                                     from /usr/include/sys/fcntl.h:3,
                                     from /usr/include/fcntl.h:14,
                                     from Thread.c:31:
    /usr/include/sys/select.h:31: error: parse error before "fd_set"
    /usr/include/sys/select.h:33: error: parse error before "fd_set"
    In file included from /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:1382,
                                     from /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h:32,
                                     from Thread.h:25,
                                     from Thread.c:32:
    /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:285: error: parse error before "rb_fdset_t"
    /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:285: warning: type defaults to `int' in declaration of `rb_fdset_t'
    /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:285: warning: data definition has no type or storage class
    /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:379: error: parse error before "fd_set"
    /home/Dmitry.Veremchuk/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:380: error: parse error before "rb_fdset_t"
    Makefile:199: recipe for target `Thread.o' failed
    make: *** [Thread.o] Error 1


    Gem files will remain installed in /home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11 for inspection.
    Results logged to /home/Dmitry.Veremchuk/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/ext/ffi_c/gem_make.out
    An error occured while installing ffi (1.0.11), and Bundler cannot continue.
    Make sure that `gem install ffi -v '1.0.11'` succeeds before bundling.

我的Gemfile中不需要FFI gem。虽然我认为Capybara需要它。 我有以下配置:
使用Windows XP和Cygwin的PC(安装了devtools);
Ruby版本1.9.3p194(在RVM中);
Rails版本3.2.8。

我试图单独安装ffi-1.0.11,但遗憾的是结果相同。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

github报告的类似错误。但直到现在还没有解决方案。