Gem install rails - can't install

Hi, I have a rhel7 system and am trying to install the rails gem, I was
wondering how to troubleshoot this since I don’t see any useful error
message. I’m guessing i’m just missing something, how to see what it
might be?

gem install rails

Building native extensions. This could take a while…
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb

checking if the C compiler accepts … yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.0.0
checking for gzdopen() in -lz… yes
checking for iconv… yes


IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:

  • 0001-Revert-Missing-initialization-for-the-catalog-module.patch
  • 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
  • 0003-Stop-parsing-on-entities-boundaries-errors.patch
  • 0004-Cleanup-conditional-section-error-handling.patch
  • 0005-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
  • 0006-Another-variation-of-overflow-in-Conditional-section.patch
  • 0007-Fix-an-error-in-previous-Conditional-section-patch.patch
  • 0008-CVE-2015-8035-Fix-XZ-compression-support-loop.patch
  • 0009-Updated-config.guess.patch
  • 0010-Fix-parsering-short-unclosed-comment-uninitialized-access.patch
  • 0011-Avoid-extra-processing-of-MarkupDecl-when-EOF.patch
  • 0012-Avoid-processing-entities-after-encoding-conversion-.patch
  • 0013-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDi.patch
  • 0014-CVE-2015-5312-Another-entity-expansion-issue.patch
  • 0015-Add-xmlHaltParser-to-stop-the-parser.patch
  • 0016-Detect-incoherency-on-GROW.patch
  • 0017-CVE-2015-7500-Fix-memory-access-error-due-to-incorre.patch
  • 0018-CVE-2015-8242-Buffer-overead-with-HTML-parser-in-pus.patch
  • 0019-Do-not-print-error-context-when-there-is-none.patch
  • 0020-xmlStopParser-reset-errNo.patch
  • 0021-Reuse-xmlHaltParser-where-it-makes-sense.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

gem install nokogiri -- --use-system-libraries
    [--with-xml2-config=/path/to/xml2-config]
    [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

bundle config build.nokogiri --use-system-libraries
bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.


Extracting libxml2-2.9.2.tar.gz into
tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2… *** 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}/lib64
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby
–help
–clean
–use-system-libraries
–enable-static
–disable-static
–with-zlib-dir
–without-zlib-dir
–with-zlib-include
–without-zlib-include=${zlib-dir}/include
–with-zlib-lib
–without-zlib-lib=${zlib-dir}/lib
–enable-cross-build
–disable-cross-build
/usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:344:in
spawn': no implicit conversion of nil into String (TypeError) from /usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:344:inblock in execute’
from
/usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:337:in
chdir' from /usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:337:inexecute’
from
/usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:331:in
extract_file' from /usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:57:inblock in extract’
from
/usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:56:in
each' from /usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:56:inextract’
from
/usr/local/share/gems/gems/mini_portile2-2.0.0/lib/mini_portile2/mini_portile.rb:147:in
cook' from extconf.rb:289:inblock (2 levels) in process_recipe’
from extconf.rb:182:in block in chdir_for_build' from extconf.rb:181:inchdir’
from extconf.rb:181:in chdir_for_build' from extconf.rb:288:inblock in process_recipe’
from extconf.rb:187:in tap' from extconf.rb:187:inprocess_recipe’
from extconf.rb:478:in `’

Gem files will remain installed in
/usr/local/share/gems/gems/nokogiri-1.6.7.2 for inspection.
Results logged to
/usr/local/share/gems/gems/nokogiri-1.6.7.2/ext/nokogiri/gem_make.out

My hypothesis would be missing headers and libraries for libxml2,
libxslt
or ruby. What’s inside mkmf.log?

Greg Navis
I help tech companies to scale Heroku-hosted Rails apps.
Free, biweekly scalability newsletter for SaaS CEOs
http://www.gregnavis.com/newsletter/

On 9 May 2016 at 08:16, Solarflow 99 [email protected] wrote:

Hi, I have a rhel7 system and am trying to install the rails gem, I was
wondering how to troubleshoot this since I don’t see any useful error
message. I’m guessing i’m just missing something, how to see what it
might be?

I think you are missing something that is required to build nokigiri.
I generally recommend using rvm to install ruby and rails, as rvm will
install all the requirements for you and will help you to manage
different versions of ruby and rails, but I don’t know about using rvm
with rhel7. On ubuntu this would be as simple as

gpg --keyserver hkp://keys.gnupg.net --recv-keys
409B6B1796C275462A1703113804BB82D39DC0E3
\curl -L https://get.rvm.io | bash -s stable --rails

See rvm.io

Colin

On Monday, May 9, 2016 at 12:16:40 AM UTC-7, Ruby-Forum.com User wrote:

Hi, I have a rhel7 system and am trying to install the rails gem, I was
wondering how to troubleshoot this since I don’t see any useful error
message. I’m guessing i’m just missing something, how to see what it
might be?

Did you run: sudo yum install -y rubygem-nokogiri before 'gem install
nokogiri` ?

And sudo yum install -y gcc ruby-devel zlib-devel is recommended if
you
have problems.

source: http://www.nokogiri.org/tutorials/installing_nokogiri.html

rpm -qa |grep libxml2

libxml2-python-2.9.1-6.el7_2.2.x86_64
libxml2-devel-2.9.1-6.el7_2.2.x86_64
libxml2-2.9.1-6.el7_2.2.x86_64

rpm -qa |grep libxslt

libxslt-1.1.28-5.el7.x86_64
libxslt-devel-1.1.28-5.el7.x86_64

cat /usr/local/share/gems/gems/nokogiri-1.6.7.2/ext/nokogiri/mkmf.log

"gcc -o conftest -I/usr/include -I/usr/include/ruby/backward
-I/usr/include -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -mtune=generic -fPIC conftest.c -L. -L/usr/lib64
-L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -m64
-lruby -lpthread -lrt -ldl -lcrypt -lm -lc "
checked program was:
/* begin */
1: #include “ruby.h”
2:
3: int main(int argc, char *argv)
4: {
5: return 0;
6: }
/
end */

“gcc -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I.
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-mtune=generic -fPIC -m64 -Werror -c conftest.c”
checked program was:
/* begin /
1: #include “ruby.h”
2:
3: int main() {return 0;}
/
end */

have_library: checking for gzdopen() in -lz… -------------------- yes

"gcc -o conftest -I/usr/include -I/usr/include/ruby/backward
-I/usr/include -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -mtune=generic -fPIC -g -DXP_UNIX -Wall
-Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline
conftest.c -L. -L/usr/lib64 -L. -Wl,-z,relro -fstack-protector
-rdynamic -Wl,-export-dynamic -m64 -lruby -lz -lpthread -lrt -ldl
-lcrypt -lm -lc "
conftest.c: In function ‘t’:
conftest.c:7:32: warning: variable ‘p’ set but not used
[-Wunused-but-set-variable]
int t(void) { void ((volatile p)()); p = (void (()()))gzdopen; return
0; }
^
checked program was:
/* begin */
1: #include “ruby.h”
2:
3: #include <zlib.h>
4:
5: /top/
6: extern int t(void);
7: int t(void) { void ((volatile p)()); p = (void (()()))gzdopen;
return 0; }
8: int main(int argc, char *argv)
9: {
10: if (argc > 1000000) {
11: printf("%p", &t);
12: }
13:
14: return 0;
15: }
/
end */


have_iconv?: checking for iconv… -------------------- yes

"gcc -o conftest -I/usr/include -I/usr/include/ruby/backward
-I/usr/include -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -mtune=generic -fPIC -g -DXP_UNIX -Wall
-Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline
conftest.c -L. -L/usr/lib64 -L. -Wl,-z,relro -fstack-protector
-rdynamic -Wl,-export-dynamic -m64 -lruby -lpthread -lrt -ldl
-lcrypt -lm -lc "
checked program was:
/* begin /
1: #include “ruby.h”
2:
3: #include <stdlib.h>
4: #include <iconv.h>
5:
6: int main(void)
7: {
8: iconv_t cd = iconv_open("", “”);
9: iconv(cd, NULL, NULL, NULL, NULL);
10: return EXIT_SUCCESS;
11: }
/
end */


Thanks for everyone’s help,

Since the problem seemed to be with nokogiri, I managed to get it to
work with gem install nokogiri – --use-system-libraries
However since there is a RPM for it, I should try that too.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs