0

I'm currently having an issue when trying to install Ruby on Rails on my Arch Linux ARM system. But it's also not just rails that won't install, it's anything I try to install using gem. Here is some extra info:

General system info: [alarm@alarm ~]$ uname -a Linux alarm 3.8.11-4-ARCH #1 SMP Sat Oct 22 11:59:55 MDT 2016 armv7l GNU/Linux

Gem output:

[alarm@alarm ~]$ gem install rails
WARNING:  You don't have /home/alarm/.gem/ruby/2.4.0/bin in your PATH,
      gem executables will not run.
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    current directory: /home/alarm/.gem/ruby/2.4.0/gems/nokogiri-1.8.0/ext/nokogiri
/usr/bin/ruby -r ./siteconf20170828-1999-1wpxia.rb extconf.rb
checking if the C compiler accepts ... *** 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}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)
    --help
    --clean
/usr/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib/ruby/2.4.0/mkmf.rb:572:in `block in try_compile'
    from /usr/lib/ruby/2.4.0/mkmf.rb:523:in `with_werror'
    from /usr/lib/ruby/2.4.0/mkmf.rb:572:in `try_compile'
    from extconf.rb:138:in `nokogiri_try_compile'
    from extconf.rb:162:in `block in add_cflags'
    from /usr/lib/ruby/2.4.0/mkmf.rb:630:in `with_cflags'
    from extconf.rb:161:in `add_cflags'
    from extconf.rb:407:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/alarm/.gem/ruby/2.4.0/gems/nokogiri-1.8.0 for inspection.
Results logged to /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/gem_make.out

mkmf.log file contents:

[alarm@alarm ~]$ cat /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.log
"gcc -o conftest -I/usr/include/ruby-2.4.0/armv7l-linux-eabihf -I/usr/include/ruby-2.4.0/ruby/backward -I/usr/include/ruby-2.4.0 -I. -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64  -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC  conftest.c  -L. -L/usr/lib -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic     -lruby  -lpthread -lgmp -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 */
1

Look at your error message for clues:

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.

and:

You have to install development tools first.

and:

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.log

So it sounds like you're missing some header files (i.e. "development tools"), which usually come bundled with libraries on Arch Linux. As the error message mentioned, you can look at the file /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.log which will tell you what header files the build process is looking for, which should lead you to the library package you need to install.

  • I added the ouputs of the mkmf.log file to my question. Not sure what to look for here. Sorry, Linux newbie here. – Brandon Gonzales Aug 29 '17 at 2:20
0

I was having this exact same problem on Arch Linux with the same logfile as above.

Based on https://bbs.archlinux.org/viewtopic.php?id=114837 I did

pacman -S base-devel

This fixed the problem for me and rails installed fine afterwards. Based on the comments in that thread it seems "pkg-config" was the package I was missing, but I didn't mind installing all of base-devel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.