ferret installation error

Problem
Trying to install ferret with sudo gem install ferret fails with the following error:

fs_store.c:300: error: format not a string literal and no format arguments
make: *** [fs_store.o] Error 1
rake aborted!
Command failed with status (2): [make…]

Solution
As the installation was not possible by using the gem install command, the next step was to download the ferret.tar.gz file extract it and try and install the plugin manually.
It also failed with the same error message.
After some googling for the error message it seems that newer gcc versions fail for non critical errors which in this case is caused by the make options -Wformat -Werror=format-security
So if you replace the:
-Werror=format-security
with
-Wno-error

in the extracted folder/ext/Makefile

and then follow the original instructions as in:

$ rake ext
$ ruby setup.rb config
$ ruby setup.rb setup
# ruby setup.rb install

It should be installed correctly.