【问题标题】:Getting error (exit code 2) for bootsnap, not allowing to set up Rails Serverbootsnap 出现错误(退出代码 2),不允许设置 Rails 服务器
【发布时间】:2019-08-18 13:19:24
【问题描述】:

尝试测试基于 Rails 构建的网站,但不断收到错误消息,拒绝让我设置服务器。

收到错误后,我使用了 'gem install bootsnap -v '1.4.2' --source 'https://rubygems.org/' 源代码为 Rubygems。同样的错误:

Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR:  Error installing bootsnap:
        ERROR: Failed to build gem native extension.

    current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2/ext/bootsnap
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -I C:/RailsInstaller/Ruby2.3.3/lib/ruby/site_ruby/2.3.0 -r ./siteconf20190327-13232-1084dsi.rb extconf.rb
creating Makefile

current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2/ext/bootsnap
make "DESTDIR=" clean

current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2/ext/bootsnap
make "DESTDIR="
generating bootsnap-i386-mingw32.def
compiling bootsnap.c
bootsnap.c: In function 'bs_cache_path':
bootsnap.c:240:3: warning: unknown conversion type character 'l' in format [-Wformat]
bootsnap.c:240:3: warning: too many arguments for format [-Wformat-extra-args]
bootsnap.c: In function 'bs_rb_fetch':
bootsnap.c:281:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
bootsnap.c: In function 'fetch_cached_data':
bootsnap.c:407:3: warning: comparison is always false due to limited range of data type [-Wtype-limits]
bootsnap.c: In function 'atomic_write_cache_file':
bootsnap.c:479:3: warning: implicit declaration of function 'mkstemp' [-Wimplicit-function-declaration]
bootsnap.c: In function 'bs_rb_fetch':
bootsnap.c:623:13: warning: 'output_data' may be used uninitialized in this function [-Wmaybe-uninitialized]
bootsnap.c:594:9: note: 'output_data' was declared here
linking shared-object bootsnap/bootsnap.so
bootsnap.o: In function `atomic_write_cache_file':
C:\RailsInstaller\Ruby2.3.3\lib\ruby\gems\2.3.0\gems\bootsnap-1.4.2\ext\bootsnap/bootsnap.c:479: undefined reference to `mkstemp'
collect2.exe: error: ld returned 1 exit status
make: *** [bootsnap.so] Error 1

make failed, exit code 2

Gem files will remain installed in C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/bootsnap-1.4.2/gem_make.out

我的 gemfile 包括这个:

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: true

我确实看到 bootsnap 位于:C:\RailsInstaller\Ruby2.3.​​3\lib\ruby\gems\2.3.0\gems

有人知道如何摆脱这个吗?它也不在我的 gem list 上。

Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR:  Error installing bootsnap:
        ERROR: Failed to build gem native extension.

    current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2/ext/bootsnap
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -I C:/RailsInstaller/Ruby2.3.3/lib/ruby/site_ruby/2.3.0 -r ./siteconf20190327-21940-1y9qpk9.rb extconf.rb
creating Makefile

current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2/ext/bootsnap
make "DESTDIR=" clean

current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2/ext/bootsnap
make "DESTDIR="
generating bootsnap-i386-mingw32.def
compiling bootsnap.c
bootsnap.c: In function 'bs_cache_path':
bootsnap.c:240:3: warning: unknown conversion type character 'l' in format [-Wformat]
bootsnap.c:240:3: warning: too many arguments for format [-Wformat-extra-args]
bootsnap.c: In function 'bs_rb_fetch':
bootsnap.c:281:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
bootsnap.c: In function 'fetch_cached_data':
bootsnap.c:407:3: warning: comparison is always false due to limited range of data type [-Wtype-limits]
bootsnap.c: In function 'atomic_write_cache_file':
bootsnap.c:479:3: warning: implicit declaration of function 'mkstemp' [-Wimplicit-function-declaration]
bootsnap.c: In function 'bs_rb_fetch':
bootsnap.c:623:13: warning: 'output_data' may be used uninitialized in this function [-Wmaybe-uninitialized]
bootsnap.c:594:9: note: 'output_data' was declared here
linking shared-object bootsnap/bootsnap.so
bootsnap.o: In function `atomic_write_cache_file':
C:\RailsInstaller\Ruby2.3.3\lib\ruby\gems\2.3.0\gems\bootsnap-1.4.2\ext\bootsnap/bootsnap.c:479: undefined reference to `mkstemp'
collect2.exe: error: ld returned 1 exit status
make: *** [bootsnap.so] Error 1

make failed, exit code 2

Gem files will remain installed in C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.2 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/bootsnap-1.4.2/gem_make.out

【问题讨论】:

    标签: ruby-on-rails ruby development-environment


    【解决方案1】:

    我也遇到了同样的问题。我正在使用 ruby​​ 2.3.0,rails 5.2.3。 为了解决这个问题,我更新了我的 Gemfile。

    # it don't work....
    # gem 'bootsnap', '>= 1.1.0', require: false
    # gem 'bootsnap', '>= 1.4.2', require: false
    
    gem 'bootsnap', require: false
    

    然后捆绑安装就可以了!

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,我也在 Windows 计算机上使用 railsinstaller。

      为了解决这个问题,我像这样更新了我的 Gemfile:

      #gem 'bootsnap', '>= 1.1.0', require: false
      gem 'bootsnap', '= 1.4.1', require: false
      

      然后在你的项目目录中运行命令:bundle install

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-09-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-16
        • 2021-08-09
        • 1970-01-01
        • 2015-04-25
        相关资源
        最近更新 更多