Error installing ribusb gem - Failed to build gem native extension - ruby-on-rails

I get the following error when installing ribusb gem
[root#localhost ~]# gem install ribusb
Building native extensions. This could take a while...
ERROR: Error installing ribusb:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
creating Makefile
make
gcc -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -Wall -c ribusb.c
ribusb.c:26:20: fatal error: libusb.h: No such file or directory
compilation terminated.
make: *** [ribusb.o] Error 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/ribusb-0.0.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/ribusb-0.0.1/./gem_make.out

If you are on a debian like system try:
apt-get install libusb-dev
If you have an other OS check the libusb homepage

Related

Installing json -v '1.8.6' gem, throws gcc error

some one in my team just updated some gem in the gemfile because of which gem json is resolved to version '1.8.6'. Which is not being installed. The error it throws is following:
anas:~$ sudo gem install json -v '1.8.6'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20171017-7274-1ea5ank.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.6/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /var/lib/gems/2.3.0/gems/json-
1.8.86/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
gcc: error: unrecognized command line option ‘-Wdate-time’
gcc: error: unrecognized command line option ‘-fstack-protector-
strong’
Makefile:239: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.3.0/gems/json-1.8.6
for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-
linux/2.3.0/json-1.8.6/gem_make.out
My ruby is 2.3.1p112 and gcc version is 4.7.4. I have tried to find out which gcc version json -v 1.8.6 use but I did not find anything.
Thanks in advance
As pr my undarstanding the solution is to install libgmp3-dev.
sudo apt-get install libgmp3-dev

How to I install Puma on Ubuntu 16.04 with rails 2.3.5 and Ruby 1.8.7?

I'm trying to deploy Fedena 2.3 (projectfedena.org) on Ubuntu 16.04, and its built with Ruby 1.8.7 on Rails 2.3.5. I've been able to install it and run with script/server, but now I'm trying to deploy it using Puma+Nginx and as soon as I run gem install puma 3.6.2 (any version above it requires Ruby > 1.8.7), it gives me this error. Does anyone know how i can fix it?
user#server:~/development$ gem install puma -v 3.6.2
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
/home/user/.rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes
creating Makefile
make
gcc -I. -I. -I/home/user/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_OPENSSL_BIO_H -fPIC -O2 -fno-tree-dce -fno-optimize-sibling-calls -fPIC -c http11_parser.c
gcc -I. -I. -I/home/user/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_OPENSSL_BIO_H -fPIC -O2 -fno-tree-dce -fno-optimize-sibling-calls -fPIC -c puma_http11.c
gcc -I. -I. -I/home/user/.rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_OPENSSL_BIO_H -fPIC -O2 -fno-tree-dce -fno-optimize-sibling-calls -fPIC -c mini_ssl.c
mini_ssl.c:4:26: fatal error: ruby/version.h: No such file or directory
#include <ruby/version.h>
^
compilation terminated.
make: *** [mini_ssl.o] Error 1
Gem files will remain installed in /home/user/.rvm/gems/ruby-1.8.7-head/gems/puma-3.6.2 for inspection.
Results logged to /home/user/.rvm/gems/ruby-1.8.7-head/gems/puma-3.6.2/ext/puma_http11/gem_make.out
The last puma version to officially support Ruby 1.8.7 is 2.16.0
https://github.com/puma/puma/blob/master/History.md#2160--2016-01-27
https://github.com/puma/puma/blob/master/History.md#300--2016-02-25
states
Ruby pre-2.0 is no longer supported
Running
gem install puma -v 3.4.0
works for my ruby 1.8.7. Try installing this puma version instead

Error installing gem

I typed 'gem install middleman' in my terminal and got the following error message:
Building native extensions. This could take a while...
ERROR: Error installing middleman:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
creating Makefile
make
compiling hitimes.c
make: gcc-4.2: No such file or directory
make: *** [hitimes.o] Error 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p429/gems/hitimes-1.2.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p429/gems/hitimes-1.2.2/ext/hitimes/c/gem_make.out
Looks like you're missing gcc-4.2
Do you have any GCC installed (if you're on a Mac, you need to install Xcode)?
which gcc
If you already have a version of gcc, you can simply symlink to it
ln -s /usr/bin/gcc /usr/bin/gcc-4.2

How to install json gem - Failed to build gem native extension

I'm trying to deploy a rails app to my ubuntu linux server. I'm using capistrano and bundler and when it gets to installing gems it fails with this error:
Installing json (1.7.7) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb
creating Makefile
make
/usr/bin/gcc -I. -I/opt/local/include -I/opt/ruby-enterprise-1.8.7- 2012.02/lib/ruby/1.8/i686-linux -I/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -g -O3 -Wall -c parser.c
In file included from /usr/include/i386-linux-gnu/bits/posix1_lim.h:157:0,
from /usr/include/limits.h:145,
from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/limits.h:169,
from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/syslimits.h:7,
from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/limits.h:34,
from /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux/ruby.h:95,
from ../fbuffer/fbuffer.h:6,
from parser.rl:1:
/usr/include/i386-linux-gnu/bits/local_lim.h:39:26: fatal error: linux/limits.h: No such file or directory
compilation terminated.
make: *** [parser.o] Error 1
I am running ruby enterprise edition 1.8.7 and can't upgrade ruby without a lot of work upgrading other sites so that's not an option right now. I tried apt-get install ruby-dev but it didn't help (I'm not sure that was the right thing anyway).
I think you need to install one of this packages :
$ apt-file search limits.h | grep 'linux/limits.h'
linux-headers-2.6.32-5-common: /usr/src/linux-headers-2.6.32-5-common/include/linux/limits.h
linux-headers-2.6.32-5-common-openvz: /usr/src/linux-headers-2.6.32-5-common-openvz/include/linux/limits.h
linux-headers-2.6.32-5-common-vserver: /usr/src/linux-headers-2.6.32-5-common-vserver/include/linux/limits.h
linux-headers-2.6.32-5-common-xen: /usr/src/linux-headers-2.6.32-5-common-xen/include/linux/limits.h
linux-libc-dev: /usr/include/linux/limits.h

bundle or install ruby-prof failed on windows

Folks,
I tried hard to install ruby-prof on windows xp and windows 7 through bundler, but not lucky at all,
in the main site of ruby-prof, it says we need to install version '0.7.3' for windows, I tried
gem install ruby-prof -v '0.7.3'
but failed, then I tried
gem install ruby-prof -v '0.7.3' --platform=mswin32
it succeeded, but when I run bundle update again, errors still there.
Gemfile is like this gem "ruby-prof", '0.7.3', errors are as below:
Installing ruby-prof (0.7.3) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for sys/times.h... no
checking for rb_os_allocated_objects()... no
checking for rb_gc_allocated_size()... no
checking for rb_gc_collections()... no
checking for rb_gc_time()... no
checking for rb_heap_total_mem()... no
checking for rb_gc_heap_info()... no
checking for rb_gc_malloc_allocations()... no
checking for rb_gc_malloc_allocated_size()... no
creating Makefile
make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_ruby_prof'" > ruby_prof-i386-ming
w32.def
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unu
sed-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-fiel
d-initializers -Wno-long-long -o ruby_prof.o -c ruby_prof.c
ruby_prof.c:241:1: warning: initialization from incompatible pointer type
ruby_prof.c:867:35: error: expected declaration specifiers or '...' before 'NODE
'
ruby_prof.c: In function 'prof_event_hook':
ruby_prof.c:1114:36: error: 'node' undeclared (first use in this function)
ruby_prof.c:1114:36: note: each undeclared identifier is reported only once for
each function it appears in
ruby_prof.c:1114:9: error: too many arguments to function 'get_method'
ruby_prof.c:867:1: note: declared here
ruby_prof.c:1120:11: warning: passing argument 5 of 'get_method' makes pointer f
rom integer without a cast
ruby_prof.c:867:1: note: expected 'struct st_table *' but argument is of type 'i
nt'
ruby_prof.c:1120:11: error: too many arguments to function 'get_method'
ruby_prof.c:867:1: note: declared here
make: *** [ruby_prof.o] Error 1
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-prof
-0.7.3 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.7.3/ext/gem_ma
ke.out
An error occured while installing ruby-prof (0.7.3), and Bundler cannot continue
.
Make sure that `gem install ruby-prof -v '0.7.3'` succeeds before bundling.
What should I do?? Help!
Many thanks here!

Resources