[zeromq-dev] C++ Majordomo Pattern

Frank Hartmann soundart at gmx.net
Wed Mar 27 08:23:19 CET 2013

Pieter Hintjens <ph at imatix.com> writes:

> On Tue, Mar 26, 2013 at 10:11 PM, Frank Hartmann <soundart at gmx.net> wrote:
>> could you please elaborate on the '3.2.x 0MQ package'? I am currently
>> using a git clone of libzmq
> Perfect.
>> Following your advise 'start with C' I have compiled now czmq revision
>> 103dc71af9910ce6e3c9ad01eb7682f3103a631a and encountered the same issue
>> with the 'rt' library
>> I can workaround this by doing: LDFLAGS=-lrt configure ..
>> but I suspect this is not the proper way of solving this issue, or?
> Sounds fine. I'm not sure why it's searching for librt though. Your
> distribution, perhaps.

This seems to be related to the glibc version man 3 clock_gettime :

CLOCK_GETRES(2) -- 2012-11-07 -- Linux Programmer's Manual

	clock_getres, clock_gettime, clock_settime  - clock and time

	#include <time.h>
	int clock_gettime(clockid_t clk_id, struct timespec *tp);

	Link with -lrt (only for glibc versions before 2.17).

I think the libczmq/CMakeLists.txt is causing this behaviour. Broken or not?

I extracted the relevant lines and added to comments prefixed with "#XXX"
from current libczmq/CMakeLists.txt

find_library(RT_LIBRARY rt)

check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)

#XXX linking of shared lib, notice _no_  ${RT_LIBRARY}

target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})


set(perf-tools local_lat ...)

add_executable(${perf-tool} perf/${perf-tool}.cpp)
target_link_libraries(${perf-tool} libzmq)

#XXX...and during build of executables the build system _is_ using ${RT_LIBRARY}:

  target_link_libraries(${perf-tool} ${RT_LIBRARY})



More information about the zeromq-dev mailing list