I encountered difficulties trying to install TravisCI’s ‘travis’ Ruby Gem on my Fedora 28 laptop. This was the full error log that I received.
[[email protected] ~]$ sudo gem install travis --no-rdoc --no-ri Building native extensions. This could take a while... ERROR: Error installing travis: ERROR: Failed to build gem native extension. current directory: /usr/local/share/gems/gems/ffi-1.9.25/ext/ffi_c /usr/bin/ruby -r ./siteconf20180624-6629-nze4f3.rb extconf.rb *** 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_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include=${ffi_c-dir}/include --with-ffi_c-lib --without-ffi_c-lib=${ffi_c-dir}/lib64 --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /usr/share/ruby/mkmf.rb:456: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:541:in `try_link0' from /usr/share/ruby/mkmf.rb:559:in `try_link' from /usr/share/ruby/mkmf.rb:660:in `try_ldflags' from /usr/share/ruby/mkmf.rb:1820:in `pkg_config' from extconf.rb:15:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /usr/local/lib64/gems/ruby/ffi-1.9.25/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /usr/local/share/gems/gems/ffi-1.9.25 for inspection. Results logged to /usr/local/lib64/gems/ruby/ffi-1.9.25/gem_make.out
After looking at the error log and searching the web about this error, it was because I’m missing some dependencies that was required. I’ve came up with a fool-proof divine formula that installs the dependencies required. The command is as follow:
sudo dnf install redhat-rpm-config ruby ruby-devel make make-devel libffi libffi-devel
I hope that helps you! If that doesn’t help resolve the issue for you, feel free to leave a comment below.
Thanks a lot, it worked for me :)