ERROR:Failed to build gem native extension

On Ubuntu 22.04.2, installed ruby 3.0 using “sudo apt install ruby-rubygems”. On running install of bundler & jekyll, got:
john@Desktop:~$ sudo gem install bundler jekyll
Fetching bundler-2.4.21.gem
Successfully installed bundler-2.4.21
Parsing documentation for bundler-2.4.21
Installing ri documentation for bundler-2.4.21
Done installing documentation for bundler after 0 seconds
Fetching terminal-table-3.0.2.gem
Fetching rouge-4.1.3.gem
Fetching forwardable-extended-2.6.0.gem
Fetching mercenary-0.4.0.gem
Fetching unicode-display_width-2.5.0.gem
Fetching safe_yaml-1.0.5.gem
Fetching pathutil-0.16.2.gem
Fetching liquid-4.0.4.gem
Fetching kramdown-2.4.0.gem
Fetching kramdown-parser-gfm-1.1.0.gem
Fetching ffi-1.16.3.gem
Fetching rb-inotify-0.10.1.gem
Fetching rb-fsevent-0.11.2.gem
Fetching listen-3.8.0.gem
Fetching jekyll-watch-2.2.1.gem
Fetching google-protobuf-3.24.4-x86_64-linux.gem
Fetching sass-embedded-1.69.4.gem
Fetching jekyll-sass-converter-3.0.0.gem
Fetching concurrent-ruby-1.2.2.gem
Fetching i18n-1.14.1.gem
Fetching http_parser.rb-0.8.0.gem
Fetching eventmachine-1.2.7.gem
Fetching em-websocket-0.5.3.gem
Fetching colorator-1.1.0.gem
Fetching jekyll-4.3.2.gem
Fetching public_suffix-5.0.3.gem
Fetching addressable-2.8.5.gem
Successfully installed unicode-display_width-2.5.0
Successfully installed terminal-table-3.0.2
Successfully installed safe_yaml-1.0.5
Successfully installed rouge-4.1.3
Successfully installed forwardable-extended-2.6.0
Successfully installed pathutil-0.16.2
Successfully installed mercenary-0.4.0
Successfully installed liquid-4.0.4
Successfully installed kramdown-2.4.0
Successfully installed kramdown-parser-gfm-1.1.0
Building native extensions. This could take a while…
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/3.0.0/gems/ffi-1.16.3/ext/ffi_c

/usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20231019-97112-zji3mb.rb extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/3.0.0/gems/ffi-1.16.3 for inspection.
Results logged to /var/lib/gems/3.0.0/extensions/x86_64-linux/3.0.0/ffi-1.16.3/gem_make.out
1 gem installed

Do the above issues matter and if so how to correct them?

there seem to be 2 ways to install ruby, one has the dev tools needed to build extensions the other does not. It sounds like you have the version without the devtools and some of the gems that you need to install require it.

I am not familiar with your os, on windows it used to be pretty clear when you went to the ruby site that there were 2 installers, one with the dev tools and one without. IIRC that changed a while back and it wad different but I don’t remember how - and instally ruby is not something I have needed to do very much.

Try installing what it is telling you - ruby-dev?

If you install the ruby-dev package with sudo apt install ruby-dev, that should help get you past this error, though there may be more lurking in the shadows for you. :zombie:

IOW, @rdyar’s advice here is correct. :smile: