0

I try to install Nanoc on Fedora Linux.

I've successfully installed Ruby using

dnf install ruby

Checked it with ruby -v and made sure rubygems is installed. Also checked version to verify installation.

The command I'm using to get nanoc installed is

gem install nanoc

When that failed I also tried

sudo gem install nanoc

but I get this error:

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

    current directory: /home/ja/.local/share/gem/ruby/3.3.0/gems/rbtree-0.4.6
/usr/bin/ruby extconf.rb
checking for ruby/version.h... *** 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=${opt-dir}/include
    --without-opt-include
    --with-opt-lib=${opt-dir}/lib64
    --without-opt-lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)
    --enable-debug
    --disable-debug
    --with-ruby-dir
    --without-ruby-dir
    --with-ruby-include=${ruby-dir}/include
    --without-ruby-include
    --with-ruby-lib=${ruby-dir}/lib64
    --without-ruby-lib
/usr/share/ruby/mkmf.rb:480:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

    from /usr/share/ruby/mkmf.rb:606:in `block in try_compile'
    from /usr/share/ruby/mkmf.rb:555:in `with_werror'
    from /usr/share/ruby/mkmf.rb:606:in `try_compile'
    from /usr/share/ruby/mkmf.rb:1151:in `block in have_header'
    from /usr/share/ruby/mkmf.rb:983:in `block in checking_for'
    from /usr/share/ruby/mkmf.rb:344:in `block (2 levels) in postpone'
    from /usr/share/ruby/mkmf.rb:314:in `open'
    from /usr/share/ruby/mkmf.rb:344:in `block in postpone'
    from /usr/share/ruby/mkmf.rb:314:in `open'
    from /usr/share/ruby/mkmf.rb:340:in `postpone'
    from /usr/share/ruby/mkmf.rb:982:in `checking_for'
    from /usr/share/ruby/mkmf.rb:1150:in `have_header'
    from extconf.rb:8:in `<main>'

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

  /home/ja/.local/share/gem/ruby/3.3.0/extensions/x86_64-linux/3.3.0/rbtree-0.4.6/mkmf.log

extconf failed, exit code 1

What should I be trying next? I feel like it's a dependency issue - I'm missing something. I just don't know what. This is a fresh install of Fedora.

3
  • 1
    You probably need to install the development files for Ruby too. Try dnf install ruby-devel. You also (very likely) need to install other parts of Ruby too which Fedora decided to unbundle from the main package for some reason... See developer.fedoraproject.org/tech/languages/ruby/… Commented Jul 9 at 21:58
  • Tried dnf install ruby-devel but it didn't help. Thank you for the suggestion and the link... took a look at the fedoraproject page and went through it. Should I maybe not install Ruby using a package manager? I'm not sure what to do next...
    – zektiv
    Commented Jul 10 at 1:18
  • 1
    You also need to have a C compiler (and related tools) installed. On Fedora, this is probably easiest with something like described here: unix.stackexchange.com/a/1344/5381. Also, you likely need the packages described in the above link in the "Installing Ruby with rbenv" section. In any case, if you do anything custom (e.g. develop / deploy your own apps), you likely want to install Ruby with a dedicated package manager instead of using the system ruby. Common choices are RVM, rbenv and chruby / ruby-install. Commented Jul 10 at 8:31

0

Browse other questions tagged or ask your own question.