IRubyをインストールする(2)

czmq, libzmqを別にビルドした方が早いかも、とどみとりさんに助言いただいたので、そういう方向で。

なんとパッケージがあったのでそれを入れる。

$ pkg install czmq

libzmq4が勝手に入った。あれ、3が要るんだっけ?
ext/rbczmq/extconf.rbの該当部分を消して、rakeしてみるがエラー。はて? あー、/usr/local/includeを見てくれてないのか。適当な場所に

$INCFLAGS << "-I/usr/local/include"

を書いてもっかい。

wave# rake               
(in /usr/home/murashin/github/rbczmq)
cd tmp/amd64-freebsd11/rbczmq_ext/2.1.7
/usr/local/bin/ruby21 -I. ../../../../ext/rbczmq/extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_without_gvl()... yes
checking for sodium.h in /usr/home/murashin/github/rbczmq/ext/libsodium/include... yes
checking for zmq.h in /usr/home/murashin/github/rbczmq/ext/zeromq/include... yes
checking for czmq.h in /usr/home/murashin/github/rbczmq/ext/czmq/include... yes
checking for main() in -lsodium... yes
checking for main() in -lzmq... yes
checking for main() in -lczmq... yes
checking for main() in -lm... yes
creating Makefile
cd -
cd tmp/amd64-freebsd11/rbczmq_ext/2.1.7
gmake
compiling ../../../../ext/rbczmq/rbczmq_ext.c
../../../../ext/rbczmq/rbczmq_ext.c:116:16: warning: format string is not a
      string literal (potentially insecure) [-Wformat-security]
    zclock_log(StringValueCStr(msg));
               ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.1/ruby/ruby.h:541:28: note: expanded from macro
      'StringValueCStr'
#define StringValueCStr(v) rb_string_value_cstr(&(v))
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../ext/rbczmq/rbczmq_ext.c:226:15: warning: 
      'rb_thread_blocking_region' is deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_m_proxy_nogvl, (void *)...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
2 warnings generated.
compiling ../../../../ext/rbczmq/poller.c
../../../../ext/rbczmq/poller.c:151:17: warning: comparison of unsigned
      expression < 0 is always false [-Wtautological-compare]
    if (timeout < 0) timeout = -1;
        ~~~~~~~ ^ ~
../../../../ext/rbczmq/poller.c:160:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_poll, (void *)&ar...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
2 warnings generated.
compiling ../../../../ext/rbczmq/pollitem.c
compiling ../../../../ext/rbczmq/context.c
../../../../ext/rbczmq/context.c:57:5: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rb_thread_call_without_gvl(rb_czmq_nogvl_zctx_destroy, (void *)ctx, ...
    ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/context.c:94:43: warning: comparison between pointer and
      integer ('VALUE' (aka 'unsigned long') and 'void *')
    if (socket == NULL || socket->context == NULL) {
                          ~~~~~~~~~~~~~~~ ^  ~~~~
../../../../ext/rbczmq/context.c:111:17: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
                rb_thread_call_without_gvl(rb_czmq_nogvl_zsocket_destroy...
                ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/context.c:193:25: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    ctx->ctx = (zctx_t*)rb_thread_call_without_gvl(rb_czmq_nogvl_zctx_ne...
                        ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/context.c:390:14: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    socket = rb_thread_call_without_gvl(rb_czmq_nogvl_socket_new, (void ...
             ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/context.c:390:12: warning: incompatible integer to
      pointer conversion assigning to 'void *' from 'VALUE'
      (aka 'unsigned long') [-Wint-conversion]
  ...= rb_thread_call_without_gvl(rb_czmq_nogvl_socket_new, (void *)&args, RUBY_UBF_IO, 0);
     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
compiling ../../../../ext/rbczmq/frame.c
../../../../ext/rbczmq/frame.c:320:12: warning: shifting a negative signed value
      is undefined [-Wshift-negative-value]
    return INT2NUM(-1);
           ^~~~~~~~~~~
/usr/local/include/ruby-2.1/ruby/ruby.h:1277:21: note: expanded from macro
      'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
                    ^~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.1/ruby/ruby.h:231:48: note: expanded from macro
      'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                            ~~~~~~~~~~~~~~~~~~~^
1 warning generated.
compiling ../../../../ext/rbczmq/loop.c
../../../../ext/rbczmq/loop.c:51:33: warning: incompatible pointer types passing
      'int (zloop_t *, zmq_pollitem_t *, void *)' to parameter of type
      'zloop_timer_fn *' (aka 'int (*)(zloop_t *, int, void *)')
      [-Wincompatible-pointer-types]
        zloop_timer(loop, 1, 1, rb_czmq_loop_breaker_callback, (void *)args[0]);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/zloop.h:85:76: note: passing argument to parameter 'handler'
      here
  ...(zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, voi...
                                                                ^
../../../../ext/rbczmq/loop.c:59:33: warning: incompatible pointer types passing
      'int (zloop_t *, zmq_pollitem_t *, void *)' to parameter of type
      'zloop_timer_fn *' (aka 'int (*)(zloop_t *, int, void *)')
      [-Wincompatible-pointer-types]
        zloop_timer(loop, 1, 1, rb_czmq_loop_breaker_callback, (void *)args[0]);
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/zloop.h:85:76: note: passing argument to parameter 'handler'
      here
  ...(zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, voi...
                                                                ^
../../../../ext/rbczmq/loop.c:92:25: warning: incompatible pointer to integer
      conversion passing 'void *' to parameter of type 'int' [-Wint-conversion]
                zloop_timer_end(loop, (void *)cb);
                                      ^~~~~~~~~~
/usr/local/include/zloop.h:90:41: note: passing argument to parameter 'timer_id'
      here
    zloop_timer_end (zloop_t *self, int timer_id);
                                        ^
../../../../ext/rbczmq/loop.c:302:35: warning: incompatible pointer types
      passing 'int (zloop_t *, zmq_pollitem_t *, void *)' to parameter of type
      'zloop_timer_fn *' (aka 'int (*)(zloop_t *, int, void *)')
      [-Wincompatible-pointer-types]
    zloop_timer(loop->loop, 1, 1, rb_czmq_loop_started_callback, loop);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/zloop.h:85:76: note: passing argument to parameter 'handler'
      here
  ...(zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, voi...
                                                                ^
../../../../ext/rbczmq/loop.c:304:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_loop_start_nogvl, (voi...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/loop.c:335:35: warning: incompatible pointer types
      passing 'int (zloop_t *, zmq_pollitem_t *, void *)' to parameter of type
      'zloop_timer_fn *' (aka 'int (*)(zloop_t *, int, void *)')
      [-Wincompatible-pointer-types]
    zloop_timer(loop->loop, 1, 1, rb_czmq_loop_breaker_callback, loop);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/zloop.h:85:76: note: passing argument to parameter 'handler'
      here
  ...(zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, voi...
                                                                ^
../../../../ext/rbczmq/loop.c:474:62: warning: incompatible pointer types
      passing 'int (zloop_t *, zmq_pollitem_t *, void *)' to parameter of type
      'zloop_timer_fn *' (aka 'int (*)(zloop_t *, int, void *)')
      [-Wincompatible-pointer-types]
  ...timer->delay, timer->times, rb_czmq_loop_timer_callback, (void *)tm);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/zloop.h:85:76: note: passing argument to parameter 'handler'
      here
  ...(zloop_t *self, size_t delay, size_t times, zloop_timer_fn handler, voi...
                                                                ^
../../../../ext/rbczmq/loop.c:500:38: warning: incompatible pointer to integer
      conversion passing 'void *' to parameter of type 'int' [-Wint-conversion]
    rc = zloop_timer_end(loop->loop, (void *)tm);
                                     ^~~~~~~~~~
/usr/local/include/zloop.h:90:41: note: passing argument to parameter 'timer_id'
      here
    zloop_timer_end (zloop_t *self, int timer_id);
                                        ^
8 warnings generated.
compiling ../../../../ext/rbczmq/timer.c
compiling ../../../../ext/rbczmq/socket.c
../../../../ext/rbczmq/socket.c:24:147: warning: format specifies type 'void *'
      but the argument has type 'zmq_sock_wrapper *' [-Wformat-pedantic]
  ...%p, context %p: GC mark", sock->flags & ZMQ_SOCKET_DESTROYED ? "(closed)" : zsocket_type_str(sock->socket), sock...
     ~~                                                                                                          ^~~~
../../../../ext/rbczmq/socket.c:24:153: warning: format specifies type 'void *'
      but the argument has type 'zctx_t *' (aka 'struct _zctx_t *')
      [-Wformat-pedantic]
  ...%p: GC mark", sock->flags & ZMQ_SOCKET_DESTROYED ? "(closed)" : zsocket_type_str(sock->socket), sock, sock->ctx);
     ~~                                                                                                    ^~~~~~~~~
../../../../ext/rbczmq/socket.c:45:147: warning: format specifies type 'void *'
      but the argument has type 'zmq_sock_wrapper *' [-Wformat-pedantic]
  ...%p, context %p: GC free", sock->flags & ZMQ_SOCKET_DESTROYED ? "(closed)" : zsocket_type_str(sock->socket), sock...
     ~~                                                                                                          ^~~~
../../../../ext/rbczmq/socket.c:45:153: warning: format specifies type 'void *'
      but the argument has type 'zctx_t *' (aka 'struct _zctx_t *')
      [-Wformat-pedantic]
  ...%p: GC free", sock->flags & ZMQ_SOCKET_DESTROYED ? "(closed)" : zsocket_type_str(sock->socket), sock, sock ? sock->ctx : NULL);
     ~~                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
../../../../ext/rbczmq/socket.c:156:93: warning: shifting a negative signed
      value is undefined [-Wshift-negative-value]
  ...|| sock->state == ZMQ_SOCKET_DISCONNECTED) return INT2NUM(-1);
                                                       ^~~~~~~~~~~
/usr/local/include/ruby-2.1/ruby/ruby.h:1277:21: note: expanded from macro
      'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
                    ^~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.1/ruby/ruby.h:231:48: note: expanded from macro
      'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                            ~~~~~~~~~~~~~~~~~~~^
../../../../ext/rbczmq/socket.c:214:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_bind, (voi...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:223:86: warning: format specifies type 'void *'
      but the argument has type 'VALUE' (aka 'unsigned long') [-Wformat]
  ...("I: %s socket %p: bound \"%s\"", zsocket_type_str(sock->socket), obj, e...
                    ~~                                                 ^~~
                    %lu
../../../../ext/rbczmq/socket.c:221:5: warning: comparison of constant -1 with
      boolean expression is always false
      [-Wtautological-constant-out-of-range-compare]
    ZmqAssert(endpoint_string != NULL);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../ext/rbczmq/rbczmq_ext.h:31:12: note: expanded from macro 'ZmqAssert'
    if (rc == -1) { \
        ~~ ^  ~~
../../../../ext/rbczmq/socket.c:221:5: warning: comparison of constant 12 with
      boolean expression is always false
      [-Wtautological-constant-out-of-range-compare]
    ZmqAssert(endpoint_string != NULL);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../ext/rbczmq/rbczmq_ext.h:32:16: note: expanded from macro 'ZmqAssert'
        if (rc == ENOMEM) rb_memerror(); \
            ~~ ^  ~~~~~~
../../../../ext/rbczmq/socket.c:255:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_connect, (...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:261:90: warning: format specifies type 'void *'
      but the argument has type 'VALUE' (aka 'unsigned long') [-Wformat]
  ...%s socket %p: connected \"%s\"", zsocket_type_str(sock->socket), obj, en...
               ~~                                                     ^~~
               %lu
../../../../ext/rbczmq/socket.c:259:5: warning: comparison of constant -1 with
      boolean expression is always false
      [-Wtautological-constant-out-of-range-compare]
    ZmqAssert(endpoint_string != NULL);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../ext/rbczmq/rbczmq_ext.h:31:12: note: expanded from macro 'ZmqAssert'
    if (rc == -1) { \
        ~~ ^  ~~
../../../../ext/rbczmq/socket.c:259:5: warning: comparison of constant 12 with
      boolean expression is always false
      [-Wtautological-constant-out-of-range-compare]
    ZmqAssert(endpoint_string != NULL);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../ext/rbczmq/rbczmq_ext.h:32:16: note: expanded from macro 'ZmqAssert'
        if (rc == ENOMEM) rb_memerror(); \
            ~~ ^  ~~~~~~
../../../../ext/rbczmq/socket.c:309:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_disconnect...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:312:93: warning: format specifies type 'void *'
      but the argument has type 'VALUE' (aka 'unsigned long') [-Wformat]
  ...socket %p: disconnected \"%s\"", zsocket_type_str(sock->socket), obj, St...
            ~~                                                        ^~~
            %lu
../../../../ext/rbczmq/socket.c:363:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_unbind, (v...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:366:88: warning: format specifies type 'void *'
      but the argument has type 'VALUE' (aka 'unsigned long') [-Wformat]
  ...%s socket %p: unbound \"%s\"", zsocket_type_str(sock->socket), obj, Stri...
               ~~                                                   ^~~
               %lu
../../../../ext/rbczmq/socket.c:471:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_zstr_send, (void ...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:474:85: warning: format specifies type 'void *'
      but the argument has type 'VALUE' (aka 'unsigned long') [-Wformat]
  ...("I: %s socket %p: send \"%s\"", zsocket_type_str(sock->socket), obj, St...
                    ~~                                                ^~~
                    %lu
../../../../ext/rbczmq/socket.c:506:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_zstr_sendm, (voi...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:558:19: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    int rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_recv, (void *...
                  ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:680:15: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_send_frame, (voi...
              ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:733:5: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    rb_thread_call_without_gvl(rb_czmq_nogvl_send_message, (void *)&args...
    ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:777:25: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    frame = (zframe_t *)rb_thread_call_without_gvl(rb_czmq_nogvl_recv_fr...
                        ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:855:25: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    message = (zmsg_t *)rb_thread_call_without_gvl(rb_czmq_nogvl_recv_me...
                        ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:897:22: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
    readable = (bool)rb_thread_call_without_gvl(rb_czmq_nogvl_poll, (voi...
                     ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
../../../../ext/rbczmq/socket.c:1390:12: warning: shifting a negative signed
      value is undefined [-Wshift-negative-value]
    return INT2NUM(-1);
           ^~~~~~~~~~~
/usr/local/include/ruby-2.1/ruby/ruby.h:1277:21: note: expanded from macro
      'INT2NUM'
# define INT2NUM(v) INT2FIX((int)(v))
                    ^~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.1/ruby/ruby.h:231:48: note: expanded from macro
      'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                            ~~~~~~~~~~~~~~~~~~~^
../../../../ext/rbczmq/socket.c:1554:104: warning: format specifies type
      'void *' but the argument has type 'VALUE' (aka 'unsigned long')
      [-Wformat]
  ...%p: set option \"IDENTITY\" \"%s\"", zsocket_type_str(sock->socket), obj...
     ~~                                                                   ^~~
     %lu
../../../../ext/rbczmq/socket.c:1763:39: error: use of undeclared identifier
      'ZMQ_STREAM_NOTIFY'
    rc = zmq_setsockopt(sock->socket, ZMQ_STREAM_NOTIFY, &optval, sizeof...
                                      ^
../../../../ext/rbczmq/socket.c:1824:19: warning: 'rb_thread_blocking_region' is
      deprecated [-Wdeprecated-declarations]
        rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_monitor_recv...
                  ^
../../../../ext/rbczmq/ruby2.h:10:3: note: expanded from macro
      'rb_thread_call_without_gvl'
  rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
  ^
/usr/local/include/ruby-2.1/ruby/intern.h:870:18: note: 
      'rb_thread_blocking_region' has been explicitly marked deprecated here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func...
                 ^
/usr/local/include/ruby-2.1//amd64-freebsd11/ruby/config.h:115:52: note: 
      expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
29 warnings and 1 error generated.
Makefile:224: ターゲット 'socket.o' のレシピで失敗しました
gmake: *** [socket.o] エラー 1
rake aborted!
Command failed with status (2): [gmake...]

Tasks: TOP => default => test => compile => compile:amd64-freebsd11 => compile:rbczmq_ext:amd64-freebsd11 => copy:rbczmq_ext:amd64-freebsd11:2.1.7 => tmp/amd64-freebsd11/rbczmq_ext/2.1.7/rbczmq_ext.so
(See full trace by running task with --trace)

ZMQ_STREAM_NOTIFYがわからないですか、そうですか...(なんやろこれ)

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だとなんでダメなんだったっけ?

iwm(4)、動いたり動かなかったり

http://d.hatena.ne.jp/msll/20150603/1433323311 に書いた
「内蔵無線LANモジュール(Intel Dual Band Wireless-AC 7265) のドライバがない」
だが、https://github.com/rpaulo/iwm.gitの 7134abba355dc50136f8ae3122a3dc2f904bfe63 時点でのコードは動いたり動かなかったりする。

具体的には、起動後に

# kldload if_iwm.ko

とするとちゃんと認識するし、

# ifconfig wlan1 create wlandev iwm0

とか、その後のwpa_supplicantを使った認証とかも動くし、通信もできる。

ところが、/boot/loader.confに

if_iwm_load="YES"

と書いてrebootすると、起動時にpanicする。なぜかfirmwareが見付からないみたいなので、/boot/loader.confの記述を

iwm7265fw_load="YES"
if_iwm_load="YES"

としておくと、もしかしたらうまくいくかもしれないが、試していない。

BroadwellでXが起動しない問題

src/sys/dev/drm2/i915/i915_drv.cにエントリ追加。

diff -ru i915.bk/i915_drv.c i915/i915_drv.c
--- i915.bk/i915_drv.c	2015-06-04 17:19:46.874564000 +0900
+++ i915/i915_drv.c	2015-06-04 17:21:44.834977000 +0900
@@ -221,6 +221,16 @@
 	.not_supported = 1,
 };
 
+static const struct intel_device_info intel_broadwell_m_info = {
+        .is_haswell = 1, .gen = 8, .is_mobile = 1,
+        .need_gfx_hws = 1, .has_hotplug = 1,
+        .has_bsd_ring = 1,
+        .has_blt_ring = 1,
+        .has_llc = 1,
+        .has_pch_split = 1,
+        .not_supported = 1,
+};
+
 #define INTEL_VGA_DEVICE(id, info_) {		\
 	.device = id,				\
 	.info = info_,				\
@@ -281,6 +291,7 @@
 	INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */
 	INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */
 	INTEL_VGA_DEVICE(0x0c16, &intel_haswell_d_info), /* SDV */
+	INTEL_VGA_DEVICE(0x1616, &intel_broadwell_m_info), /* mobile */
 	{0, 0}
 };

src/sys/dev/drm2/drm_pciids.h にPCIのID?を追加

--- drm_pciids.h.bk	2015-06-04 17:12:52.062533000 +0900
+++ drm_pciids.h	2015-06-04 17:13:47.049281000 +0900
@@ -55,6 +55,7 @@
 	{0x8086, 0x0416, CHIP_I9XX|CHIP_I915, "Intel Haswell (M)"}, \
 	{0x8086, 0x041A, CHIP_I9XX|CHIP_I915, "Intel Haswell (S)"}, \
 	{0x8086, 0x0C16, CHIP_I9XX|CHIP_I915, "Intel Haswell (SDV)"}, \
+	{0x8086, 0x1616, CHIP_I9XX|CHIP_I915, "Intel Broadwell (?)"}, \
         {0x8086, 0x1632, CHIP_I9XX|CHIP_I915, "Intel Broadwell (ULT)"}, \
         {0x8086, 0x1636, CHIP_I9XX|CHIP_I915, "Intel Broadwell (ULT)"}, \
         {0x8086, 0x163B, CHIP_I9XX|CHIP_I915, "Intel Broadwell (Iris)"}, \

してデバッグメッセージオンにしてみた。kldloadすると

info: [drm] Initialized drm 1.1.0 20060810
[drm:pid56670:drm_probe_helper] drmn0 desc: Intel Broadwell (?)

というふうに2行目がでるようになったけど、どこで止まってるんだろこれ?

kernel moduleをロードしたときに最初に呼ばれるのって, moduledata_tの二つ目の引数?に書いてある関数(src/sys/dev/drm2/drm_os_freebsd.cのdrm_modevent)で、MOD_LOADのところが実行されるという認識なんだけど、中を見ると

static int
drm_modevent(module_t mod, int type, void *data)
{

        switch (type) {
        case MOD_LOAD:
                TUNABLE_INT_FETCH("drm.debug", &drm_debug);
                TUNABLE_INT_FETCH("drm.notyet", &drm_notyet);
                break;
        }
        return (0);
}

なんかたいしたことしてないような、、、? 初期化処理をどっかでやってるんだと思うんだけど、、、

やっぱりintel_broadwell_m_info.not_supported が 1 っていうのが効いてるのかなあ、と思い、0にしてmakeしてkldload i915kmsしたら、画面が暗転!どうやらpanicした模様。なるほどなあ。

スワップ領域がないのでクラッシュダンプがとれないことに気づいた。あー。

これ以上は手に追えないし、放置かな。

Broadwellのagp(4)が認識されない問題

src/sys/dev/agp/agp_i810.c の agp_i810_matches にエントリがないので、足してみる。古いノートPCと比べると、どうやら pciconf -l して、vgapci0のchipのところに書いてあるアドレスが分かればいいようだ。

% pciconf -l
hostb0@pci0:0:0:0:	class=0x060000 card=0x833810f7 chip=0x16048086 rev=0x09 hdr=0x00
vgapci0@pci0:0:2:0:	class=0x030000 card=0x833810f7 chip=0x16168086 rev=0x09 hdr=0x00
(以下略)

この場合は0x16168086である。

というわけで、エントリを加えてみる。名前はよくわからない(Intel Core i7-5600Uなのだが、、、)ので、適当にしておく。中身はHaswellのコードそのままで動くことを期待してみる。

--- agp_i810.c.bk	2015-06-04 14:52:16.699075000 +0900
+++ agp_i810.c	2015-06-04 15:23:39.580476000 +0900
@@ -797,6 +797,11 @@
 		.driver = &agp_i810_hsw_driver
 	},
 	{
+		.devid = 0x16168086,
+		.name = "Broadwell",
+		.driver = &agp_i810_hsw_driver
+	},
+	{
 		.devid = 0,
 	}
 };

カーネル作りなおしてリブート。

# cd /usr/src
# make buildkernel KERNCONF=WAVE
# make installkernel KERNCONF=WAVE
# shutdown -r now

すると、

agp0: <Broadwell> on vgapci0
agp0: aperture size is 256M, detected 4194300k stolen memory

という感じで認識された。おー。

xf86-video-intelドライバ(2.99.917)でXが起動するか試してみたが、起動しなかった。

まだどこか変更しないといけないのかな。src/sys/dev/drm{,2}が怪しい?

FreeBSDでunboundを使う

FreeBSD 10以降?ではunboundが最初から入っている。

設定は、/etc/rc.confに

local_unbound_enable="YES"

と書くだけ。

ところが、無線LAN経由で名前解決しようとするとうまくいかなかった。

% drill www.yahoo.co.jp

はうまくいかないが、

% drill www.yahoo.co.jp @192.168.xxx.xxx

(ここで192.168.xxx.xxxは無線LAN APのアドレス)はうまくいくのである。/etc/unbound/forward.confにはちゃんと192.168.xxx.xxxのアドレスが書いてある。

よくわからないが、結局、DNSSEC非対応にすることで解決した。

/etc/unbound/conf.d/disable-dnssec.confを

server:
       module-config: "iterator"

で作成し(/etc/unbound/conf.d/以下のファイル名は何でもよい; 設定を/etc/unbound/unbound.confに直接書くのは勧められない。なぜなら/usr/sbin/local-unbound-setupで上書きされる可能性があるからである)、

% sudo service local_unbound restart

とすれば、

% drill www.yahoo.co.jp

で名前解決できるようになった。

Let’s Note SX4でFreeBSD-CURRENTを使う

いくつか問題がある。

  • Xのドライバが対応していない
  • 内蔵無線LANモジュール(Intel Dual Band Wireless-AC 7265) のドライバがない
  • xrandr(1)がエラーを吐く
  • suspend/resumeができない

順番に見ていく。

Xのドライバが対応していない

intelドライバ (ports/x11-drivers/xf86-video-intel)の最新版 (2.99.917, https://github.com/freebsd/freebsd-ports-graphics.git にある) を入れてもハードウェアを認識しないようだ (http://d.hatena.ne.jp/msll/20150527/1432708323 参照のこと)。

vesaドライバも使えない。

scfbドライバ (ports/x11-drivers/xf86-video-scfb) を使って解決。

ところが、mplayerでデフォルト(xv)で動画の拡大ができない。これはmplayer -vo glなどとして解決

内蔵無線LANモジュール(Intel Dual Band Wireless-AC 7265) のドライバがない

https://github.com/erikarn/freebsd-iwa を持ってきてパッチを当てた上で試したが、ハードウェアを認識しない (http://d.hatena.ne.jp/msll/20150527/1432708323 参照のこと)。

https://github.com/rpaulo/iwm.git を持ってきて試した。kldload if_iwm.ko した時点でハードウェアは認識するが、panicする。

USB接続の無線LAN子機 BUFFALO WLI-UC-G301N を購入して解決。これはrun(4)で認識する

xrandr(1)がエラーを吐く

xrandrを実行すると以下の出力を得る。

% xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1600 x 900, current 1600 x 900, maximum 1600 x 900
default connected 1600x900+0+0 0mm x 0mm
1600x900       0.00*

おそらくscfbドライバを使っているせいだろう。

解決の見込みなし。これはマズい。

suspend/resumeができない

S3に移行してみた。

$ sudo acpiconf -s 3

freezeしました。

まあできなくてもいまのところ困らないのでよしとする。

総評

xrandr(1)がエラーを吐くのがつらい。これではプレゼンできない。
intelのドライバがうまく動くようになるのを待つしかないかな。