Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Freshened up build to work via rebar only #10

Merged
merged 2 commits into from

3 participants

@kevsmith
  • Updated rebar version
  • Added pre/post build hooks to handle building ZeroMQ
  • Added c_src/Makefile to modularize build

These changes should make it possible for erlzmq2 to participate as a dep in a rebar-managed project. I haven't been able to fully verify the build on my Snow Leopard MBP w/R14B03 as the unit tests crash the emulator :(

@kevsmith kevsmith Freshened up build to work via rebar only:
* Updated rebar version
* Added pre/post build hooks to handle building ZeroMQ
* Added c_src/Makefile to modularize build
2b57f69
@yrashk
Owner

Kevin, thanks for the patch, I will review it shortly. Speaking about the crash, have you done ulimit -n 1200 prior running the test? If yes, can you please open a separate issue as it works here?

@kevsmith

I've been able to verify the test suite works with these changes. evax was kind enough to point out a couple of sysctl.conf entries I was missing which fixed everything. Let me know if there's anything I can do to help get this merged in.

@yrashk
Owner

This patch moves deps directory to c_src, is there any chance this can be adjusted so that deps is back at the root level?

@yrashk yrashk merged commit d0b50df into from
@loxs

Hey guys, sorry if this is not the right place to ask, but don't know a better one.
What should I do in order to include erlzmq2 as a dependency to my project?

I have something like this in my rebar.config:

    {deps, [{webmachine, "1.8.*", {git, "git://github.com/basho/webmachine", "HEAD"}},
            {eredis, ".*", {git,"git://github.com/wooga/eredis.git","master"}},
            {erlzmq, ".*", {git, "https://github.com/zeromq/erlzmq2.git", "master"}}
           ]}.

and it doesn't work.
I get the following:

$ make
==> mochiweb (get-deps)
==> webmachine (get-deps)
==> eredis (get-deps)
==> erlzmq (get-deps)
==> wsapi (get-deps)
==> mochiweb (compile)
==> webmachine (compile)
==> eredis (compile)
==> erlzmq (compile)
Compiling c_src/erlzmq_nif.c
c_src/erlzmq_nif.c: In function ‘erlzmq_nif_setsockopt’:
c_src/erlzmq_nif.c:344:10: error: ‘ZMQ_LINGER’ undeclared (first use in this function)
c_src/erlzmq_nif.c:344:10: note: each undeclared identifier is reported only once for each function it appears in
c_src/erlzmq_nif.c:345:10: error: ‘ZMQ_RECONNECT_IVL’ undeclared (first use in this function)
c_src/erlzmq_nif.c:346:10: error: ‘ZMQ_BACKLOG’ undeclared (first use in this function)
c_src/erlzmq_nif.c: In function ‘erlzmq_nif_getsockopt’:
c_src/erlzmq_nif.c:395:10: error: ‘ZMQ_RECOVERY_IVL_MSEC’ undeclared (first use in this function)
c_src/erlzmq_nif.c:434:10: error: ‘ZMQ_TYPE’ undeclared (first use in this function)
c_src/erlzmq_nif.c:435:10: error: ‘ZMQ_LINGER’ undeclared (first use in this function)
c_src/erlzmq_nif.c:436:10: error: ‘ZMQ_RECONNECT_IVL’ undeclared (first use in this function)
c_src/erlzmq_nif.c:437:10: error: ‘ZMQ_RECONNECT_IVL_MAX’ undeclared (first use in this function)
c_src/erlzmq_nif.c:438:10: error: ‘ZMQ_BACKLOG’ undeclared (first use in this function)
c_src/erlzmq_nif.c:439:10: error: ‘ZMQ_FD’ undeclared (first use in this function)
ERROR: $CC -c $CFLAGS $DRV_CFLAGS c_src/erlzmq_nif.c -o c_src/erlzmq_nif.o failed with error: 1
make: *** [all] Error 1

Otherwise, if I go to the directory where it downloaded erlzmq2 and execute "make", it works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 8, 2011
  1. @kevsmith

    Freshened up build to work via rebar only:

    kevsmith authored
    * Updated rebar version
    * Added pre/post build hooks to handle building ZeroMQ
    * Added c_src/Makefile to modularize build
Commits on Jun 12, 2011
  1. @kevsmith
This page is out of date. Refresh to see the latest.
Showing with 45 additions and 29 deletions.
  1. +10 −28 Makefile
  2. +29 −0 c_src/Makefile
  3. BIN  rebar
  4. +6 −1 rebar.config
View
38 Makefile
@@ -1,42 +1,24 @@
-LINUX=$(shell uname | grep Linux | wc -l | xargs echo)
+all: compile
-
-ifeq ($(LINUX),1)
-ZMQ_FLAGS=--with-pic
-else
-ZMQ_FLAGS=
-endif
-
-ifndef ZEROMQ_VERSION
-ZEROMQ_VERSION=v2.1.7
-endif
-
-all: perf
-
-deps/zeromq2:
- @mkdir -p deps
- @git clone git://github.com/zeromq/zeromq2-1.git deps/zeromq2
- @echo $(ZEROMQ_VERSION)
- @cd deps/zeromq2 && git checkout $(ZEROMQ_VERSION)
-
-deps/zeromq2/src/.libs/libzmq.a: deps/zeromq2
- @cd deps/zeromq2 && ./autogen.sh && ./configure $(ZMQ_FLAGS) && make
-
-dependencies: deps/zeromq2/src/.libs/libzmq.a
-
-compile: dependencies
+compile:
@./rebar compile
-perf: compile
+perftest: compile
@cd perf && erlc erlzmq_perf.erl
+clean:
+ @./rebar clean
+
+distclean: clean
+ @cd c_src;make distclean
+
test: compile
@./rebar eunit
docs:
@./rebar doc
-bench: perf
+bench: perftest
@echo 'Running benchmarks, this could take some time...'
@mkdir -p graphs
@./perf/perfgraphs.py
View
29 c_src/Makefile
@@ -0,0 +1,29 @@
+LINUX=$(shell uname | grep Linux | wc -l | xargs echo)
+DEPS=../deps
+
+ifeq ($(LINUX),1)
+ZMQ_FLAGS=--with-pic
+else
+ZMQ_FLAGS=
+endif
+
+ifndef ZEROMQ_VERSION
+ZEROMQ_VERSION=v2.1.7
+endif
+
+all: $(DEPS)/zeromq2/src/.libs/libzmq.a
+
+clean:
+ @cd $(DEPS)/zeromq2; make clean
+
+distclean:
+ @rm -rf $(DEPS)
+
+$(DEPS)/zeromq2:
+ @mkdir $(DEPS)
+ @git clone git://github.com/zeromq/zeromq2-1.git $(DEPS)/zeromq2
+ @echo $(ZEROMQ_VERSION)
+ @cd $(DEPS)/zeromq2 && git checkout $(ZEROMQ_VERSION)
+
+$(DEPS)/zeromq2/src/.libs/libzmq.a: $(DEPS)/zeromq2
+ @cd $(DEPS)/zeromq2 && ./autogen.sh && ./configure $(ZMQ_FLAGS) && make
View
BIN  rebar
Binary file not shown
View
7 rebar.config
@@ -1,4 +1,9 @@
+{erl_opts, [debug_info, warnings_as_errors]}.
+
{port_envs,
[{"DRV_LDFLAGS","deps/zeromq2/src/.libs/libzmq.a -shared $ERL_LDFLAGS -lstdc++ -luuid"},
{"darwin", "DRV_LDFLAGS", "deps/zeromq2/src/.libs/libzmq.a -bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"},
- {"DRV_CFLAGS","-Ic_src -Ideps/zeromq2/include -g -Wall -fPIC $ERL_CFLAGS"}]}.
+ {"DRV_CFLAGS","-Ic_src -Ideps/zeromq2/include -g -Wall -fPIC $ERL_CFLAGS"}]}.
+
+{pre_hooks,[{compile,"make -C c_src"},
+ {clean, "make -C c_src clean"}]}.
Something went wrong with that request. Please try again.