Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails 5.0.0 when installing "nio4r" : Failed to build gem native extension

Here is the logs: http://pastebin.com/CAgur9xd

Installing nio4r 1.2.1 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160720-8272-c88sgk.rb extconf.rb --with-cflags=-std=c99
checking for unistd.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
        --without-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=C:/RailsInstaller/Ruby2.2.0/bin/$(RUBY_BASE_NAME)
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
         from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:321:in `open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:321:in `open'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
        from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
        from extconf.rb:3:in `<main>'

extconf failed, exit code 1

when installing bundle it returns(starts at line 117 in the logs ):

Installing nio4r 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

So the bundle can't be installed. It returns at the end :

An error occurred while installing nio4r (1.2.1), and Bundler cannot continue.
Make sure that `gem install nio4r -v '1.2.1'` succeeds before bundling.

Note :I have tried the solutions in other questions, but it is still the same. If it is possible to install "nio4r" manually please tell me how .

like image 365
Mfms99 Avatar asked Jul 20 '16 11:07

Mfms99


1 Answers

this may be related: GCC compilation error when installing Nokogiri

I found a error. i had a 2 gcc versions installed on my system and I just run brew unlink gcc and that solved the problem.

this was my case too. benw unlink gcc worked

like image 76
equivalent8 Avatar answered Nov 15 '22 17:11

equivalent8