Ruby on Rails - how to install capybara gem in Windows? - ruby-on-rails

Please help me to install capybara gem in Windows.
>gem install capybara
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing capybara:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... 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
generating ffi_c-i386-mingw32.def
Configuring libffi
configure: WARNING: cache variable lt_cv_path_LD contains a newline
configure: WARNING: cache variable lt_cv_path_LD contains a newline
make -C "/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-mingw32"
make[1]: Entering directory `/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-mingw32'
Makefile:318: *** missing separator. Stop.
make[1]: Leaving directory `/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-mingw32'
make: *** ["/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-mingw32"/.libs/libffi_convenience.a] Error 2
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/gem_make.out
I already have downloaded and installed some 1,7 GB "QT" thing as my colleagues advised, with no effect.
Update:
>gem install ffi
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... 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
generating ffi_c-i386-mingw32.def
Configuring libffi
configure: WARNING: cache variable lt_cv_path_LD contains a newline
configure: WARNING: cache variable lt_cv_path_LD contains a newline
make -C "/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-mingw32"
make[1]: Entering directory `/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-min
gw32'
Makefile:318: *** missing separator. Stop.
make[1]: Leaving directory `/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-ming
w32'
make: *** ["/c/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/libffi-i386-mingw32"/.libs/libff
i_convenience.a] Error 2
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.1.5/ext/ffi_c/gem_make.out

I've ran capybara tests on a windows xp machine before. You probably need the devkit: http://rubyinstaller.org/downloads/

It is probably better to work with the RailsInstaller instead, it will save you from a lot of pitfalls trying to sort out dependencies other than the RubyInstaller itself.

Related

Semian gem Gem::Ext::BuildError: ERROR on Ubuntu 20.04

Fresh Ubuntu 20.04 install, when I try to bundle my project, I get this error which I'm not sure what's producing it.
Installing semian 0.10.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/fran/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/semian-0.10.0/ext/semian
/home/fran/.rbenv/versions/2.4.3/bin/ruby -r ./siteconf20200922-5726-1n8pgk.rb extconf.rb --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
checking for openssl/sha.h... yes
checking for SHA1() in -lcrypto... yes
checking for sys/ipc.h... yes
checking for sys/sem.h... yes
checking for sys/types.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl()... yes
creating Makefile
current directory: /home/fran/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/semian-0.10.0/ext/semian
make "DESTDIR=" clean
current directory: /home/fran/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/semian-0.10.0/ext/semian
make "DESTDIR="
compiling resource.c
In file included from /home/fran/.rbenv/versions/2.4.3/include/ruby-2.4.0/ruby.h:33,
from sysv_semaphores.h:15,
from resource.h:10,
from resource.c:1:
/home/fran/.rbenv/versions/2.4.3/include/ruby-2.4.0/ruby/ruby.h:631:1: error: ‘const’ attribute on function returning ‘void’ [-Werror=attributes]
631 | CONSTFUNC(void rb_secure_update(VALUE));
| ^~~~~~~~~
In file included from /home/fran/.rbenv/versions/2.4.3/include/ruby-2.4.0/ruby/ruby.h:2008,
from /home/fran/.rbenv/versions/2.4.3/include/ruby-2.4.0/ruby.h:33,
from sysv_semaphores.h:15,
from resource.h:10,
from resource.c:1:
/home/fran/.rbenv/versions/2.4.3/include/ruby-2.4.0/ruby/intern.h:257:1: error: ‘const’ attribute on function returning ‘void’ [-Werror=attributes]
257 | CONSTFUNC(void rb_error_untrusted(VALUE));
| ^~~~~~~~~
/home/fran/.rbenv/versions/2.4.3/include/ruby-2.4.0/ruby/intern.h:259:1: error: ‘const’ attribute on function returning ‘void’ [-Werror=attributes]
259 | CONSTFUNC(void rb_check_trusted(VALUE));
| ^~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:242: resource.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/fran/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/semian-0.10.0 for inspection.
Results logged to /home/fran/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/semian-0.10.0/gem_make.out
An error occurred while installing semian (0.10.0), and Bundler cannot continue.
Make sure that `gem install semian -v '0.10.0' --source 'https://rubygems.org/'` succeeds before bundling.
Did not have this problem bundling other projects that require native extensions, just this one where we make use of the semian gem.

Error installing therubyracer on osx 10.12.4

I have gone through a lot of answers on a similar questions but I have not been successful. I am trying to install therubyracer 0.12.3 on my MAC OSX 10.12.4 and I am receiving the following error. Please help. Been stuck with this for two days now.
sudo gem install therubyracer -v '0.12.3'
Building native extensions.
This could take a while... ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
current directory: /Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3/ext/v8
/Users/aj035785/.rvm/rubies/ruby-2.3.1/bin/ruby -r
./siteconf20170420-2619-13h8man.rb extconf.rb checking for main() in
-lpthread... yes checking for main() in -lobjc... yes creating Makefile
current directory:
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3/ext/v8
make "DESTDIR=" clean
current directory:
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3/ext/v8
make "DESTDIR=" compiling accessor.cc make:
/usr/local/opt/apple-gcc42/bin/g++-4.2: No such file or directory
make: *** [accessor.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3
for inspection. Results logged to
/Users/aj035785/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0/therubyracer-0.12.3/gem_make.out
Blockquote
I feel this might be the root cause -
make: /usr/local/opt/apple-gcc42/bin/g++-4.2: No such file or directory

gem install nio4r -v 2.0.0 fails on windows 10

I'm attempting to setup rails on windows 10 but I keep encountering an issue while attempting to install the nio4r gem.
C:\>gem install nio4r -v 2.0.0
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nio4r:
ERROR: Failed to build gem native extension.
current directory:
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/nio4r-2.0.0/ext/nio4r
C:/RailsInstaller/Ruby2.3.0/bin/ruby.exe -r ./siteconf20170317-11700-9smes9.rb extconf.rb
checking for unistd.h... yes
checking for sys/select.h... no
checking for poll.h... no
checking for sys/epoll.h... no
checking for sys/event.h... no
checking for port.h... no
checking for sys/resource.h... no
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r-2.0.0/mkmf.log
current directory:
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/nio4r-2.0.0/ext/nio4r
C:\Program Files (x86)\GnuWin32\bin\ "DESTDIR=" clean
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
current directory:
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/nio4r-2.0.0/ext/nio4r
C:\Program Files (x86)\GnuWin32\bin\ "DESTDIR="
'C:\Program' is not recognized as an internal or external command,operable program or batch file.
make failed, exit code 1
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/nio4r-2.0.0 for inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r-2.0.0/gem_make.out
Initially, I attempted to avoid using the "railsinstaller" for windows but I ended up trying it thinking it may have a workaround for this unfortunately it did not and I still have the same issue.
Any ideas as to how I can fix this?
The developers seemingly have fixed this issue as everything went through for me the last time I tried this some
weeks ago!

noi4r gem install issues

In trying to install the nio4r gem. I tried
gem install nio4r -v '1.0.0'
The error that pops up is:
Building native extensions. This could take a while...
ERROR: Error installing nio4r:
ERROR: Failed to build gem native extension.
/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150406-11564-1qtifmf.rb extconf.rb
checking for rb_thread_blocking_region()... no
checking for sys/select.h... yes
checking for poll.h... yes
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port.h... no
checking for sys/resource.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling monitor.c
In file included from monitor.c:6:
In file included from ./nio4r.h:10:
/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
warning use "ruby/io.h" instead of "rubyio.h"
...
What am I getting wrong? Is it an issue with my RVM?
With some basic updates, I was able to get it to work.
bundle update
and then
bundle
installs the gem.
Thanks to https://github.com/celluloid/nio4r/issues/46
Another approach would be to install a later version of ruby with RVM and do bundle again. Both works

Fail to install fxruby on Mac 10.9.2

I use homebrew to install the fox library successfully.
When I try sudo gem install fxruby, it fails.
The error message is shown below.
Building native extensions. This could take a while...
ERROR: Error installing fxruby:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sys/time.h... yes
checking for signal.h... yes
checking for deflate() in -lz... yes
checking for png_create_read_struct() in -lpng... yes
checking for jpeg_mem_init() in -ljpeg... no
checking for TIFFSetErrorHandler() in -ltiff... no
checking for XftInit() in -lXft... yes
checking for XShmQueryVersion() in -lXext... yes
checking for XFindContext() in -lX11... yes
checking for glXCreateContext() in -lGL... yes
checking for gluNewQuadric() in -lGLU... yes
checking for FXRbCommon.h in ./include... no
creating Makefile
make "DESTDIR="
compiling librb.c
compiling core_wrap.cpp
core_wrap.cpp:593:10: fatal error: 'FXRbCommon.h' file not found
#include "FXRbCommon.h"
^
1 error generated.
make: *** [core_wrap.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/fxruby-1.6.28 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/fxruby-1.6.28/ext/fox16_c/gem_make.out
I had the exact same problem (Mac 10.9.3) and followed the advice on https://github.com/larskanis/fxruby/issues/7 (actually reference a Debian installation)
This was basically to try sudo gem install fxruby -- --with-cppflags=-I./include
Worked for me
Hope it helps.

Resources