IRubyをインストールする

IRubyというのがあるそうなので、インストールしようと思った。

$ pkg install iruby
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
Fetching packagesite.txz: 100%    5 MiB   1.1MB/s    00:05    
Processing entries: 100%
FreeBSD repository update completed. 24379 packages processed.
pkg: No packages available to install matching 'iruby' have been found in the repositories

ないか。となると、gemで入れよう、と思うわけで、gemで入れようとする。

$ gem install iruby
....
compiling timer.c
linking shared-object rbczmq_ext.so
/usr/bin/ld: /usr/local/lib/ruby/gems/2.1/gems/rbczmq-1.7.9/ext/rbczmq/dst/lib/libczmq.a(zbeacon.o): relocation R_X86_64_32S against `__stderrp' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/ruby/gems/2.1/gems/rbczmq-1.7.9/ext/rbczmq/dst/lib/libczmq.a: could not read symbols: Bad value
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make: stopped in /usr/local/lib/ruby/gems/2.1/gems/rbczmq-1.7.9/ext/rbczmq

make failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.1/gems/rbczmq-1.7.9 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.1/extensions/amd64-freebsd-11/2.1/rbczmq-1.7.9/gem_make.out

あら。-fPIC問題。手でとってきてビルドすることにする。

$ git clone http://github.com/methodmissing/rbczmq
$ cd rbczmq
$ git submodule init
$ git submodule update
$ rake

やっぱりとまる。あとはどっかに-fPICをいれたらえーんやろ、と。libczmq.aに対していわれているので、libczmq.aをコンパイルするときに付ければよさそうだ。それはext/rbczmq/extconf.rbで制御してるっぽいので、みていくと、どうも-fPICはついているっぽい。他に怪しいところはというと、libczmqのところで--disable-sharedになってたのを--enable-sharedに書き換え。
今度はテストでエラーが出る。あきらめるか.....λ

はて、static link libraryだとなんでダメなんだったっけ?