Working with old Rails 2.4 on Ubuntu 20.04

Installing old Rails 2.4 (well, somebody need to maintain that legacy code…) on Ubuntu with Ruby 2.4.10 You can get failure during Nokogirii installation. Log ends with:

compiling xslt_stylesheet.c
 xslt_stylesheet.c:112:13: warning: ‘swallow_superfluous_xml_errors’ defined but not used [-Wunused-function]
   112 | static void swallow_superfluous_xml_errors(void * userdata, xmlErrorPtr error, …)
       |             ^~~~~~~~~~
 cc1: warning: unrecognized command line option ‘-Wno-self-assign’
 cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
 cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
 linking shared-object nokogiri/nokogiri.so
 Cleaning files only used during build.
 rm -rf /home/viciu/.rvm/gems/ruby-2.4.10@rails42/gems/nokogiri-1.10.10/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports
 rm -rf /home/viciu/.rvm/gems/ruby-2.4.10@rails42/gems/nokogiri-1.10.10/ports
 current directory: /home/viciu/.rvm/gems/ruby-2.4.10@rails42/gems/nokogiri-1.10.10/ext/nokogiri
 make "DESTDIR=" install
 make: /usr/bin/mkdir: Command not found
 make: *** [Makefile:200: .sitearchdir.-.nokogiri.time] Error 127
 make install failed, exit code 2

Simplest fix is to link mkdir in place where make expects to find it (on Ubuntu make is in /bin not /usr/bin):

sudo ln -s /bin/mkdir /usr/bin/mkdir

After that You will could install gem and bundle install will work.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.