pp-man
pp-man

Reputation: 59

Error installing rails failed to build gem native extension

So I'm trying to Install Rails with this guide: http://guides.rubyonrails.org/getting_started.html

And I keep getting this error (below).

Any suggestion?

I'm working on the cmd (windows 8).

(c) 2013 Microsoft Corporation. All rights reserved.

I'm typing: ruby -v

And then I get: ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]

I'm typing: sqlite3 --version

And then I get: 3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e 86726f2171d

I'm typing: gem install rails

And then I get:

Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/websocket-driver-0
.6.5/ext/websocket-driver
C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20180318-5748-xd7wo5.rb extconf.rb
creating Makefile

current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/websocket-driver-0.6.5
/ext/websocket-driver
make "DESTDIR=" clean

current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/websocket-driver-0.6.5
/ext/websocket-driver
make "DESTDIR="
generating websocket_mask-x64-mingw32.def
make: *** No rule to make target `/C/Ruby24-x64/include/ruby-2.4.0/ruby.h', need
ed by `websocket_mask.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/websoc
ket-driver-0.6.5 for inspection.
Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0
/websocket-driver-0.6.5/gem_make.out

Upvotes: 1

Views: 1497

Answers (2)

Artur Cichosz
Artur Cichosz

Reputation: 1054

I just had exactly the same problem with websocket-driver native extension (Windows 10) with exact the same error message:

make: *** No rule to make target `/C/Ruby24-x64/include/ruby-2.4.0/ruby.h', need
ed by `websocket_mask.o'.  Stop.

make failed, exit code 2

The solution in my case was to pay attention during "MSYS2-Devkit" installation to chose the option "3" (MSYS2 and MINGW development toolchain)

After that "bundle install" in my case installed and compiled all dependencies of a rails project

Upvotes: 2

lacostenycoder
lacostenycoder

Reputation: 11206

Try using rvm using Cygwin. It should help solve ruby version issues.

see https://rvm.io/rvm/install

Upvotes: 0

Related Questions