Wednesday 15 December 2021

Upgrade to ubuntu 20.04 kills bundle / gem install

 

The Problem

After upgrading to Ubuntu 20.04, Ruby on Rails gem installations fail. If you use rvm this fails with rvm-managed environments too. Running 

bundle install 
bundle update
gem install

 all fail. 

Error Messages

You will see errors that look like this (in this case it's the byebug gem but other gems will also give the same error):

ERROR: Error installing byebug:

       ERROR: Failed to build gem native extension.

make DESTDIR\= install

make: /usr/bin/mkdir: Command not found


The Solution

The problem is that Ubuntu 20.04 changes the location of the mkdir command, moving it from /usr/bin to /bin. 

The easiest solution is to symbolically link the mkdir command back into /usr/bin.

  1. su - to root (or use sudo to execute the command below)
  2. ln -s /bin/mkdir /usr/bin/

Your bundle should now install as it used to.

FFI gem build failure

Another problem encountered after upgrading to Ubuntu 20.04 is that builds fail referencing the ffi gem. For example, error messags that include this text are seen:
   Ignoring ffi-xxxxx because its extensions are not built

The "xxxxx" part is the ffi version number.

Simply issue this command:
     gem pristine ffi

and the ffi libraries and other artefacts will be reinstated correctly, resolving the problem.

No comments:

Post a Comment