OS: Ubuntu 20.04
Nokogiri Version: 1.10.10
While trying to install nokogiri, it looks for /usr/bin/mkdir if it's not found it fails. I was able to circumvent it using the following trick
$ sudo ln -s /bin/mkdir /usr/bin/mkdir
It would be great if nokogiri looks for mkdir rather than /usr/bib/mkdir to prevent this issue. The full output is attached here:
Hi @mindaslab, thanks for opening this issue, and I'm sorry you're having trouble.
This is very curious, as I develop and maintain Nokogiri on Ubuntu 20.04 and have never seen this issue on my system. Can you help me reproduce it?
Let's start with the bits you skipped when you reported this -- the template for an installation issue asks a few questions:
mkmf.log file generated during the failed installation?uname -a and the contents of /etc/lsb-release.If you could reply with answers to those questions then I may be able to direct our attention a bit better.
I googled a bit and found a similar issue from the mysql2 gem: https://github.com/brianmario/mysql2/issues/724
Can you also please reply with the value of RbConfig::MAKEFILE_CONFIG['MAKEDIRS']? And can you tell us where your Ruby came from (rvm, rbenv, chruby, apt, ...)?
@flavorjones thanks for looking into this. I'm running into the same issue and the result of RbConfig::MAKEFILE_CONFIG['MAKEDIRS'] is similar to the output in the mysql2 gem issue:
:001 > RbConfig::MAKEFILE_CONFIG['MAKEDIRS']
=> "/usr/bin/mkdir -p"
My Ruby came from rvm (version 1.29.10) and my Ruby version is version 2.7.1 [ x86_64 ] on Ubuntu 20.04 as well.
The mkdir command for me is located at /bin/mkdir and @mindaslab's suggestion to add a symlink worked.
@dko26 Did RVM compile this ruby locally during installation, or did it install a precompiled binary from somewhere? I'm assuming it's the latter (precompiled binary) but it might be helpful to confirm that.
@flavorjones yes you're right, it's installing a precompiled binary:
$ rvm reinstall ruby-2.7.1
ruby-2.7.1 - #removing rubies/ruby-2.7.1 - please wait
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.7.1.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.7.1 - #configure
ruby-2.7.1 - #download
ruby-2.7.1 - #validate archive
ruby-2.7.1 - #extract
ruby-2.7.1 - #validate binary
ruby-2.7.1 - #setup
Hi everyone,
I am not a very fluent Linux / Ubuntu 20.04 user and seems to experience the same problem as @mindaslab
I get a very long stack trace which ends by
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
linking shared-object nokogiri/nokogiri.so
Cleaning files only used during build.
rm -rf /home/maxence/.rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri/tmp/x86_64-pc-linux-gnu/ports
rm -rf /home/maxence/.rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ports
current directory: /home/maxence/.rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR=" install
make: /usr/bin/mkdir: Command not found
make: *** [Makefile:202: .sitearchdir.-.nokogiri.time] Error 127
make install failed, exit code 2
Gem files will remain installed in /home/maxence/.rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10 for inspection.
Results logged to /home/maxence/.rvm/gems/ruby-2.7.1/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/gem_make.out
Can I use @mindaslab fix as a permanent fix (provided my error is indeed same)?
@maxence33 I'm not really sure how permanent it is but it's been working fine for me since I applied the fix at least.
Hi all,
I spent a few minutes looking into this today to determine whether an upstream issue should be opened at https://github.com/rvm/rvm/issues.
Maybe the most interesting thing I discovered is that the Ubuntu-published docker image for 20.04 (focal) contains /usr/bin/mkdir:
$ docker run -it ubuntu:focal ls -lt /usr/bin/mkdir /bin/mkdir
-rwxr-xr-x 1 root root 88408 Sep 5 2019 /bin/mkdir
-rwxr-xr-x 1 root root 88408 Sep 5 2019 /usr/bin/mkdir
Big if true -- this might explain why Ruby is compiled assuming /usr/bin/mkdir will always be present. I'll open an issue upstream and link to it.
Hey all, I've been trying for the last few hours to get Ubuntu Focal running in a VM to reproduce what you're seeing, but it's turned into a huge yak shave and so I need to ask for your help.
Can someone directly affected by this issue please file an issue upstream at https://github.com/rvm/rvm/issues ? You may want to reference https://github.com/rvm/rvm/pull/4922 as well as @raelgc who is the kind person who's volunteered to build the RVM binaries for Ubuntu.
Sorry I can't be of more direct help here.
I just got here with the same issue. Did anyone file the issue upstream yet? I don't see anything referenced. :(
I think it's not Nokogiri related but rather on how RVM is bundling Ruby 2.7.1 (also the patch on top works fine)
I got the same issues as well when updating from ruby 2.7.0 to 2.7.1 and running bundle install. Patch on top worked fine.
Hi! If you're directly affected by this issue, please don't comment here. Instead, please report it upstream as requested above:
Can someone directly affected by this issue please file an issue upstream at https://github.com/rvm/rvm/issues ? You may want to reference rvm/rvm#4922 as well as
@raelgcwho is the kind person who's volunteered to build the RVM binaries for Ubuntu.
As a workaround, you can run sudo ln -s /bin/mkdir /usr/bin/mkdir but the root cause is that the precompiled Ruby that's being distributed by RVM assumes the toolchain you're using includes /usr/bin/mkdir which doesn't exist in the base distro (but notably and inexplicably does exist in the official Docker image).
Thanks for being a good open-source community member and reporting this upstream.
Most helpful comment
Hi all,
I spent a few minutes looking into this today to determine whether an upstream issue should be opened at https://github.com/rvm/rvm/issues.
Maybe the most interesting thing I discovered is that the Ubuntu-published docker image for 20.04 (focal) contains
/usr/bin/mkdir:Big if true -- this might explain why Ruby is compiled assuming /usr/bin/mkdir will always be present. I'll open an issue upstream and link to it.