先安装 uuid 的库:/usr/ports/devel/uuid
ZeroMQ 在 ./configure 中做了 OpenBSD 的检查,但 platform.h 居然没有 ZMQ_HAVE_OPENBSD 的宏。
所以在做完 ./configure 后,要手动修改 src/platform.hpp,增加:
#define ZMQ_HAVE_OPENBSD 1
同时还要修改 src/uuid.h, src/uuid.cpp,我自己"山寨"了一个 diff:
------------------------ src/uuid.hpp ------------------------
26c26
< #if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD
---
> #if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD || defined ZMQ_HAVE_OPENBSD
86a87,88
> char *string_buf;
> #elif defined ZMQ_HAVE_OPENBSD
------------------------ src/uuid.cpp ------------------------
76a77,108
> #elif defined ZMQ_HAVE_OPENBSD
>
> zmq::uuid_t::uuid_t ()
> {
> ::uuid_rc_t rc;
> ::uuid_t *uuid;
>
> rc = uuid_create(&uuid);
> zmq_assert(rc == UUID_RC_OK);
>
> rc = uuid_make(uuid, UUID_MAKE_V1);
> zmq_assert(rc == UUID_RC_OK);
>
> string_buf = NULL;
> rc = uuid_export(uuid, UUID_FMT_STR, &string_buf, NULL);
> zmq_assert(rc == UUID_RC_OK);
>
> uuid_destroy(uuid);
>
> create_blob ();
> }
>
> zmq::uuid_t::~uuid_t ()
> {
> free (string_buf);
> }
>
> const char *zmq::uuid_t::to_string ()
> {
> return string_buf;
> }
-------------------------------------------------------------
当然,还有给一堆 Makefile 里面增加 LDFLAGS:
LDFLAGS = -L/usr/local/lib -luuid
还要修改下 ~ctx_t(), ~session_t() 两个析构函数,将其从 private: 移到 public: 中。
否则报 warning 会打断 gmake 的过程。
终于搞定。跑了一下测试程序,貌似米啥问题。hoho~
评论