newgemのインストールでredcloth_attributesがエラー
久しぶりの更新。
gem作りにチャレンジしようと思ってnewgemをインストールしようとしたら、以下のエラーがでた。
エラー内容
Building native extensions. This could take a while... ERROR: Error installing newgem: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb checking for main() in -lc... yes creating Makefile make gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -I. -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -fPIC -O0 -Wall -Werror -o redcloth_attributes.o -c redcloth_attributes.c ragel/redcloth_attributes.c.rl: 関数 ‘redcloth_attribute_parser’ 内: ragel/redcloth_attributes.c.rl:26:11: エラー: 変数 ‘act’ が設定されましたが使用されていません [-Werror=unused-but-set-variable] cc1: すべての警告はエラーとして取り扱われます make: *** [redcloth_attributes.o] エラー 1
対処方法
どうやらnewgemと一緒にインストールされるredclothなんちゃらがいけないらしい。
調べてみたら同じような症状をgithubのディスカッションで発見した。
これによるとRedClothを以下のようにオプションつけてインストールすればいいとのこと。
gem install RedCloth -- --with-cflags=-w
これでRedClothがインストールできたので、あとはnewgemもインストールすることができました。