Installation issue on Ubuntu 22.04


I’m on Ubuntu 22.04, Ruby Version 3.0.2, Gem Version 3.3.5. I’ve followed installation process over here:

And I stuck at the last piece:

gem install jekyll bundler

results in

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

    current directory: /home/hannes/gems/gems/ffi-1.16.3/ext/ffi_c
/usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20240124-5977-no0ppz.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:
/usr/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/lib/ruby/3.0.0/mkmf.rb:564:in `try_link0'
	from /usr/lib/ruby/3.0.0/mkmf.rb:582:in `try_link'
	from /usr/lib/ruby/3.0.0/mkmf.rb:684:in `try_ldflags'
	from /usr/lib/ruby/3.0.0/mkmf.rb:1851:in `pkg_config'
	from extconf.rb:9:in `system_libffi_usable?'
	from extconf.rb:46:in `<main>'

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


extconf failed, exit code 1

Gem files will remain installed in /home/hannes/gems/gems/ffi-1.16.3 for inspection.
Results logged to /home/hannes/gems/extensions/x86_64-linux/3.0.0/ffi-1.16.3/gem_make.out
Successfully installed bundler-2.5.5
Parsing documentation for bundler-2.5.5
Done installing documentation for bundler after 0 seconds
1 gem installed

mkmf.log shows

"pkg-config --exists libffi"
| pkg-config --libs libffi
=> "-lffi\n"
"x86_64-linux-gnu-gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-3.0.0 -I/usr/include/ruby-3.0.0/ruby/backward -I/usr/include/ruby-3.0.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2   -g -O2 -ffile-prefix-map=/build/ruby3.0-ohOwi0/ruby3.0-3.0.2=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c  -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -lruby-3.0  -lm   -lc"
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

I’ve already installed these dependencies:

  • ruby-dev
  • build-essential
  • g++
  • make
  • libffi-dev
  • gcc
  • ruby-full
  • zliblg-dev
  • rbenv
  • ubuntu-dev-tools
  • ruby-all-dev
  • ruby3.0-dev

Thanks for your Help.

you get this error when the ruby dev tools are not installed but I see you say you have them.

My guess is you have ruby installed more than once and one has it the other doesn’t.

I would remove ruby and start over.

Your error message seems to show it is using ruby 3.0.0.

If the suggestion by @rdyar does not work, I created the following video that shows how to build Jekyll in a Ubuntu Docker container. While I think you are not using Docker, you can watch this video to see the steps I used if that is helpful.

1 Like

Thank you @rdyar for your reply. Unfortunately uninstall and reinstall ruby by apt didn’t helped. Maybe I need a certain ruby version but in the end I didn’t follow this way no more.

@BillRaymond thanks for introducing docker to me. Though I’m not a video guy and didn’t watched you tutorial to the end. I got jekyll running on my machine by the Bret Fisher way in the end.