29

I already installed all neccessary libraries it couldn't found (libxslt-dev, libxml2-dev), specified -- --with-xml2-include=/usr/include/libxml2 --use-system-libraries, but it still fails with

make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.-.nokogiri.time] Error 127
dem1tris
  • 1,012
  • 8
  • 15
  • 2
    It's a poor makefile if it includes hardcoded paths for utilities like that. it should simply rely on the user to set their PATH correctly, else it's inherently non-portable. – MadScientist Nov 02 '20 at 21:05
  • @MadScientist Of course poor, especially if you can't change it (like here) – dem1tris Nov 02 '20 at 21:20
  • 12
    @MadScientist It turns out that this path is detected when Ruby is compiled, and that value is assumed when any Gem is compiled. So it's not hard-coded per se, but it is set at Ruby build time, not Gem build time. Ubuntu incorporated an upstream change somewhere between 20.04 and 20.04.1 that moved `mkdir`. RVM's Ubuntu binaries are built on 20.04, so if you try to use them on 20.04.1, you will get this error for all gem installations. See https://github.com/rvm/rvm/issues/4975. You can work around the issue with `rvm reinstall 2.7.2 --disable-binary` (substitute desired version). – nitrogen Nov 25 '20 at 01:32
  • 1
    IMO even hardcoding this fully-qualified path into a Ruby environment is a bad idea. Relocatability is a very useful feature. There's really no point in this. That's what PATH was invented. – MadScientist Nov 25 '20 at 16:05
  • Seems to affect rbenv, too. Reinstalling, or better, bumping from ruby 2.7.3 to 2.7.4 resolved it for me. – Kjell Jul 17 '21 at 08:31
  • This Q is closed, unfortunately, but worth mentioning that the accepted answer fixes an error in GitHub actions: `racc` install error: `make: /usr/bin/mkdir: No such file or directory`. Simply use the accepted answer: `run: | ln -s /bin/mkdir /usr/bin/mkdir gem install bundler bundle config path vendor/bundle bundle install --jobs 4 --retry 3` – Timur Shtatland Jun 15 '22 at 16:22

1 Answers1

69

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

dem1tris
  • 1,012
  • 8
  • 15