I’m having another blast at preparing PDF documents from a database repository of infrastructure assets which requires the use of the mysql2 gem on Fedora 23.
Now, I have had many years experience building this stuff from source and even though Ruby has a reputation for being difficult to work with, this time it’s definitely Fedora that’s bearing unberable.
Install the mysql2 gen should be a simple matter of,
gem install mysql2
But not when you get this error:
checking for ruby/thread.h... *** extconf.rb failed ***
With extra advice about probably missing developer tools or libraries. I have the compiler, mariadb-devel and ruby-devel packages installed, everything that’s required to build the gem, but still no good.
I eventually found the mkmf.log record mentioned in the error output which contained something I’d not seen before:
error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
Searching online for this came across http://stackoverflow.com/questions/34624428/g-error-usr-lib-rpm-redhat-redhat-hardened-cc1-no-that-file-and-directory and the simple solution is to run,
dnf install redhat-rpm-config gem install mysql2 -v '0.3.16'
And we’re done.
Whod’ve thought that an rpm-config package would be a pre-requisite for installing ruby gems? And yet another example of having to spend an hour fixing numerous tedious problems and sub-problems introduced by system developers rather than being able to get on with the task in hand.