erlang-czmq icon indicating copy to clipboard operation
erlang-czmq copied to clipboard

Doesn't link correctly on systems with clock_gettime

Open steven807 opened this issue 10 years ago • 5 comments

On Ubuntu, a program that uses clock_gettime (in both libsodium and zeromq) requires the "-rt" library. Because rebar.config.script hard-codes the libraries, czmq-port doesn't link correctly.

steven807 avatar Jun 04 '14 21:06 steven807

This commit appears to address this: 46091115867541db58ff9cdc5211c02773ded0d2

However, this breaks the builds for OSX (no librt there).

sanmiguel avatar Jul 18 '14 13:07 sanmiguel

This is an issue in czmq imo. It used to be addressed in 2.1.0. but the bug came back in latest version and master.

@steven807 which version of czmq are you using?

benoitc avatar Aug 08 '14 06:08 benoitc

on macosx you need to use the -lcrt flag:

--- a/c_src/Makefile.in
+++ b/c_src/Makefile.in
@@ -1,10 +1,10 @@
 CC = @CC@
 CFLAGS = -Wall -g2
 INCLUDES = -I@ERLANG_LIB_DIR_erl_interface@/include
-LFLAGS = -L@ERLANG_LIB_DIR_erl_interface@/lib -lstdc++ -lrt
+LFLAGS = -L@ERLANG_LIB_DIR_erl_interface@/lib -lstdc++ -lcrt
 LIBS = -lerl_interface -lei -lpthread -lczmq
 STATIC_DIR = $(shell pwd)/.libs
-BUILD_CZMQ = 
+BUILD_CZMQ =
 ENABLE_STATIC = @enable_static@

 ifeq ($(ENABLE_STATIC), yes)

The platform should probably be checked in the configure file and rebar to handle it. cc @gar1t (tested with latest czmq installed via homebrew)

benoitc avatar Aug 09 '14 00:08 benoitc

sorry was a little too much busy. I am working on a fix, it should land tomorrow.

benoitc avatar Sep 24 '14 08:09 benoitc

I was able to build it on Mac OS 10.10.3 by removing the -lrtflag in rebar.config.script and c_src/Makefile.in.

zweizeichen avatar Jun 20 '15 11:06 zweizeichen