I am trying to install gem res-client in my redhat linux server.Installed whatever dependencies i found but still not working for me.
Ruby Version:
ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux]
[root#feeds ]# gem install rest-client
Building native extensions. This could take a while...
ERROR: Error installing rest-client:
ERROR: Failed to build gem native extension.
current directory: /opt/rh/rh-ruby23/root/usr/local/share/gems/gems/unf_ext-0.0.7.6/ext/unf_ext
/opt/rh/rh-ruby23/root/usr/bin/ruby -I /opt/rh/rh-ruby23/root/usr/local/share/ruby/site_ruby -r ./siteconf20190429-62674-e4of20.rb extconf.rb
checking for main() in -lstdc++... no
creating Makefile
current directory: /opt/rh/rh-ruby23/root/usr/local/share/gems/gems/unf_ext-
0.0.7.6/ext/unf_ext
make "DESTDIR=" clean
rm -f
rm -f unf_ext.so *.o .bak mkmf.log ..time
current directory: /opt/rh/rh-ruby23/root/usr/local/share/gems/gems/unf_ext-0.0.7.6/ext/unf_ext
make "DESTDIR="
g++ -I. -I/opt/rh/rh-ruby23/root/usr/include -I/opt/rh/rh-ruby23/root/usr/include/ruby/backward -I/opt/rh/rh-ruby23/root/usr/include -I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -mtune=generic -m64 -o unf.o -c unf.cc
make: g++: Command not found
make: *** [unf.o] Error 127
make failed, exit code 2
Gem files will remain installed in /opt/rh/rh-ruby23/root/usr/local/share/gems/gems/unf_ext-0.0.7.6 for inspection.
Results logged to /opt/rh/rh-ruby23/root/usr/local/lib64/gems/ruby/unf_ext-0.0.7.6/gem_make.out
Can anyone please suggest.
Thanks
Sina
It looks like you are missing the gcc-c++ compiler. Install it with:
yum install gcc-c++
build-essential g++ are the missing ones. So try installing:
yum install build-essential g++
then install the required gem:
gem install rest-client
hope it helps....
Thanks .
I reinstall ruby and dependencies then it worked.
Regards,
Sina
I'm running Ruby 2.0.0p645 on a Linux AWS.
I tried running gem install mechanize, but got this error:
Building native extensions. This could take a while...
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.0 extconf.rb
checking for main() in -lstdc++... no
creating Makefile
make "DESTDIR="
g++ -I. -I/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -m64 -o unf.o -c unf.cc
make: g++: Command not found
make: *** [unf.o] Error 127
Gem files will remain installed in /path/to/.gem/ruby/2.0/gems/unf_ext-0.0.7.1 for inspection.
Results logged to /path/to/.gem/ruby/2.0/gems/unf_ext-0.0.7.1/ext/unf_ext/gem_make.out
How do I fix this so I can install mechanize on my virtual box?
Looks like you might need to install libstdc++. For Debian or Ubuntu try:
sudo apt-get install build-essential libstdc++6
and then retry installing the gem.
Not having any luck installing Jekyll on Mac OSX 10.9.1
I have rvm installed and also Xcode 5.0.2.
When I run gem install jekyll it tells me...
Permission denied -
/Users/Vivid/.rvm/gems/ruby-1.9.2-p320/extensions/x86_64-darwin-12
I then ran sudo gem install jekyll and I then get:
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
creating Makefile
make clean
make
gcc-4.2 -I. -I/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/x86_64-darwin12.2.0 -I/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -I/Users/Vivid/.rvm/usr/include -fno-common -pipe -o porter.o -c porter.c
make: gcc-4.2: No such file or directory
make: *** [porter.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /Users/Vivid/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-12/1.9.1/fast-stemmer-1.0.2/gem_make.out
This is the contents of /Users/Vivid/.rvm/gems/ruby-1.9.3-p327/gems/fast-stemmer-1.0.2/ext/gem_make.out:
/Users/Vivid/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
creating Makefile
make
compiling porter.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [porter.o] Error 1
Something is clearly not right. Any advice would be magic, cheers.
You need to install gcc-4.2. Make sure you have Homebrew installed and run
brew install apple-gcc42
Make sure you see happy output when you run:
which gcc-4.2
Then try re-running:
sudo gem install jekyll
Boom! Installed.
Im trying to install gems that require the ruby DevKit to be installed. E.g:
gem install sqlite3
This is the output:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby.exe extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_next_stmt()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
creating Makefile
make
gcc -I. -I/usr/local/include/ruby-1.9.1/i386-cygwin -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE
_RB_PROC_ARITY -DHAVE_SQLITE3_INITIALIZE -DHAVE_SQLITE3_NEXT_STMT -DHAVE_SQLITE3_BACKUP_INIT -DHAVE_SQLITE3_ENABLE_LOAD_EXTENSION -DHAVE_SQL
ITE3_LOAD_EXTENSION -I/usr/local/include -I/opt/local/include -I/sw/local/include -I/usr/include -O3 -g -Wall -Wno-unused-parameter -Wno-
parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -o backup.o -c backup.c
make: gcc: Command not found
make: *** [backup.o] Error 127
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
I do have make and gcc installed and don't understand why it's complaining that a command can't be found.
This happens not only if i try to install the sqlite3 gem but also other gems that require de devkit to be installed.
The DevKit is for the MingW port of YARV, not the Cygwin port. The Cygwin port doesn't need the DevKit, since Cygwin itself already contains all the necessary tools, libraries, and headers.
The latest MacRuby release notes (v0.6) state that the authors have managed to get this release working with the SQLite and Nokogiri gems. However when I run sudo macgem install nokogiri I get the following errors:
ERROR: Error installing nokogiri:
extconf failed:
and then a bunch of paths followed by:
libxml2 is missing. try 'port install libxml2' or 'yum install libxml2'
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/nokogiri-1.4.1/ext/nokogiri/extconf.rb:1:in `<main>': libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' (SystemExit)
Anyone knows how to get this working? My platform is Mac OS X 10.6.3. Nokogiri normally (meaining on plain old ruby 1.8.7) installs without a problem.
Progress
OK, so I have:
git clone http://github.com/tenderlove/nokogiri.git
cd nokogiri/ext/nokogiri
Then I've rebuilt the macports libraries with sudo port upgrade --enforce-variants libxml2 +universal and sudo port upgrade --enforce-variants libxslt +universal
Then I've executed macruby extconf.rb successfully
Then I proceed to make
At this point it errors out like so:
/usr/bin/gcc -I. -I/opt/local/include/libxml2 -I/opt/local/include/ -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/universal-darwin10.0 -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/ruby/backward -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0 -I. -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -fexceptions -fno-common -pipe -O3 -g -Wall -Wno-parentheses -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -arch i386 -arch x86_64 -o html_document.o -c html_document.c
In file included from ./html_document.h:4,
from html_document.c:1:
./nokogiri.h:35:16: error: st.h: No such file or directory
In file included from ./html_document.h:4,
from html_document.c:1:
./nokogiri.h:35:16: error: st.h: No such file or directory
lipo: can't open input file: /var/folders/wU/wUGgoG1JGeKBgwalWLPMAU+++TI/-Tmp-//ccSgAUv5.out (No such file or directory)
make: *** [html_document.o] Error 1
I think you have to build from source since only Nokogiri's head is MacRuby compliant
If you use the source code of GitHub,
$ git clone git://github.com/tenderlove/nokogiri.git
$ cd nokogiri/ext/nokogiri/
$ sed -i.bak 's/<st.h>/<ruby\/st.h>/' nokogiri.h
If you make a gem package of Nokogiri,
$ cd ../..
$ sudo gem install hoe
$ sudo gem install rake-compiler
$ sudo gem install racc
$ sudo gem install rexical
$ mkdir ~/.rubyforge; touch ~/.rubyforge/user-config.yml
$ rake gem
An Above command, I used ruby of the system default. ("/usr/bin/ruby")
$ cd pkg
$ sudo macgem install nokogiri-1.4.1.gem
I think you have to build a libxml2 as Universal binary.
If you use MacPorts, execute the command below.
$ sudo port upgrade --enforce-variants libxml2 +universal
$ sudo port upgrade --enforce-variants libxslt +universal
$ sudo port upgrade --enforce-variants sqlite3 +universal
It still fails in the installation (x _ x;
$ sudo macgem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
make failed:
["/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin/macruby extconf.rb", "checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for libexslt/exslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include,/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/libxml2,/usr/include,/usr/include/libxml2... yes\nchecking for xmlParseDoc() in -lxml2... yes\nchecking for xsltParseStylesheetDoc() in -lxslt... yes\nchecking for exsltFuncRegister() in -lexslt... yes\nchecking for xmlRelaxNGSetParserStructuredErrors()... yes\nchecking for xmlRelaxNGSetParserStructuredErrors()... yes\nchecking for xmlRelaxNGSetValidStructuredErrors()... yes\nchecking for xmlSchemaSetValidStructuredErrors()... yes\nchecking for xmlSchemaSetParserStructuredErrors()... yes\ncreating Makefile\n", "make", "/usr/bin/gcc -I. -I/opt/local/include/libxml2 -I/opt/local/include/ -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/universal-darwin10.0 -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/ruby/backward -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0 -I. -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -fexceptions -fno-common -pipe -O3 -g -Wall -Wno-parentheses -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -arch i386 -arch x86_64 -o html_document.o -c html_document.c\nIn file included from ./nokogiri.h:75,\n from ./html_document.h:4,\n from html_document.c:1:\n./xml_document.h:5:16: error: st.h: No such file or directory\nIn file included from ./nokogiri.h:75,\n from ./html_document.h:4,\n from html_document.c:1:\n./xml_document.h:5:16: error: st.h: No such file or directory\nlipo: can't open input file: /var/tmp//cco5nNYw.out (No such file or directory)\nmake: *** [html_document.o] Error 1\n"]
I uploaded to GitHub which I made a package.
http://wiki.github.com/Watson1978/nokogiri-macruby/