UbuntuにRoadworkerを入れようとしたら出たエラーとトラブルシューティング

インストール

  • 既にrubyは入っているのでgemでroadworkerをインストール
gem install roadworker --no-rdoc --no-ri
ERROR:  Error installing roadworker:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/pcaprub-0.12.4/ext/pcaprub_c
/usr/bin/ruby2.3 -r ./siteconf20180711-12985-rs61am.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/pcaprub-0.12.4 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pcaprub-0.12.4/gem_make.out
apt-get install ruby-dev
  • ruby-dev入れてなかったのでインストール

もっかいgemをチャレンジ

ERROR:  Error installing roadworker:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/pcaprub-0.12.4/ext/pcaprub_c
/usr/bin/ruby2.3 -r ./siteconf20180711-709-9vgsep.rb extconf.rb

[*] Running checks for pcaprub_c code...
platform is x86_64-linux-gnu
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl()... yes
checking for pcap_open_live() in -lpcap... no
checking for pcap_setnonblock() in -lpcap... no
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pcaprub-0.12.4/mkmf.log

current directory: /var/lib/gems/2.3.0/gems/pcaprub-0.12.4/ext/pcaprub_c
make "DESTDIR=" clean

current directory: /var/lib/gems/2.3.0/gems/pcaprub-0.12.4/ext/pcaprub_c
make "DESTDIR="
compiling pcaprub.c
pcaprub.c:11:18: fatal error: pcap.h: No such file or directory
compilation terminated.
Makefile:239: recipe for target 'pcaprub.o' failed
make: *** [pcaprub.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.3.0/gems/pcaprub-0.12.4 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pcaprub-0.12.4/gem_make.out
  • libpcapを入れればいいとの事
apt-get install libpcap-dev
gem install roadworker --no-rdoc --no-ri
  • 無事にインストール完了!