Skip to content

problem with building erlzmq2 on MacOs #24

Closed
RomanShestakov opened this Issue Oct 19, 2011 · 10 comments

3 participants

@RomanShestakov

Hello,

I have a couple of problems with adding erlzmq2 as a dependency to my project with rebar and building it on Mac.

  1. I have the following in my rebar.config

{deps, [
{'erlsom', ".", {git, "git://github.com/willemdj/erlsom.git", "master"}},
{'detergent', ".
", {git, "git://github.com/devinus/detergent.git", "master"}},
{'log4erl', ".", {git, "git://github.com/ahmednawras/log4erl.git", "master"}},
{'erlzmq', ".
", {git, "git://github.com/zeromq/erlzmq2.git", "master"}}
]}.

but during build I am getting the following err:

rebar compile
==> erlsom (compile)
==> detergent (compile)
==> mochiweb (compile)
==> log4erl (compile)
==> erlzmq (compile)
i686-apple-darwin11-llvm-gcc-4.2: deps/zeromq2/src/.libs/libzmq.a: No such file or directory
ERROR: $CC c_src/erlzmq_nif.o c_src/vector.o $LDFLAGS $DRV_LDFLAGS -o priv/erlzmq_drv.so failed with error: 1
make: *** [compile] Error 1

this seems to mean that erlzmq doesnt pull zeromq2 from github as its dependency.

if I change to erlzmq dir and execute make, the project does built but when I try to run tests with 'make test' I am getting the following error:

bash-3.2$ make test
==> erlzmq (compile)
make[1]: Nothing to be done for `all'.
==> erlzmq (eunit)
Compiled src/erlzmq_nif.erl
Compiled src/erlzmq.erl
Compiled test/erlzmq_test.erl
undefined
*** test module not found ***
::erlzmq_nif

=ERROR REPORT==== 19-Oct-2011::19:55:45 ===
The on_load function for module erlzmq_nif returned {error,
{load_failed,

"Failed to load NIF library: 'dlopen(/Users/romanshestakov/Development/betfairgateway/deps/erlzmq/priv/erlzmq_drv.so, 2): no suitable image found. Did find:\n\t/Users/romanshestakov/Development/betfairgateway/deps/erlzmq/priv/erlzmq_drv.so: mach-o, but wrong architecture'"}}

which seems to indicate that though erlzmq_drv.so was built, it was built for incorrect archetecture.

any ideas how to make the build work with MacOS

Regards, Roman

@yrashk
The ZeroMQ project member
yrashk commented Oct 19, 2011

Pull the latest verison, it has a different rebar.config

@yrashk yrashk closed this Oct 19, 2011
@dhammika
@yrashk
The ZeroMQ project member
yrashk commented Oct 19, 2011

@dhammika, I still believe it is a problem of using an outdated version (old version required use of make, and pasted rebar.config is different from one in master).

@RomanShestakov

hi Yurii,

I am building erlzmq2 with latest master from github

the rebar.config is the one I use in my project, I added
{'erlzmq', ".*", {git, "git://github.com/zeromq/erlzmq2.git", "master"}}
as a dependency hoping that when I build it, it will pull erlzmq2 and build it. but it doesn't work very well.

  1. though, erlzmq2 gets pulled from repo it fails to build, because it erlzmq2 doesn't build zeromq2 first

  2. so , when I change to deps/erlzmq/ and run make, it does build zeromq2, and builds a driver

but make test doesn't run on mac, I use Lion , Software Mac OS X Lion 10.7.2 (11C74)

and priv/erlzmq_drv.so gets build for 64bit:

bash-3.2$ file priv/erlzmq_drv.so
priv/erlzmq_drv.so: Mach-O 64-bit bundle x86_64

when I run "make test", I am getting :
=ERROR REPORT==== 19-Oct-2011::23:54:56 ===
The on_load function for module erlzmq_nif returned {error,
{load_failed,
"Failed to load NIF library: 'dlopen(/Users/romanshestakov/Development/betfairgateway/deps/erlzmq/priv/erlzmq_drv.so, 2): no suitable image found. Did find:\n\t/Users/romanshestakov/Development/betfairgateway/deps/erlzmq/priv/erlzmq_drv.so: mach-o, but wrong architecture'"}}
undefined
*** test module not found ***
::erlzmq_nif

but Erlang install (Erlang R14B04 (erts-5.8.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false])

which I built from source seems to be for 32 bit:

bash-3.2$ file /usr/local/bin/erlc
/usr/local/bin/erlc: Mach-O executable i386

so, the main question is : how to make erlzmq and zeromq2 to get build for 32bit with rebar?

Regards, Roman

@dhammika
@yrashk
The ZeroMQ project member
yrashk commented Oct 20, 2011

@RomanShestakov: is this what you have in your rebar.config: https://github.com/zeromq/erlzmq2/blob/master/rebar.config ?

@yrashk
The ZeroMQ project member
yrashk commented Oct 20, 2011

I apologize, I wasn't reading your issue attentively, you quoted your rebar.config

@yrashk
The ZeroMQ project member
yrashk commented Oct 20, 2011

My first guess is that you might have older rebar which doesn't support pre_hooks used in rebar.config of erlzmq2. Please check if that is the case.

@yrashk
The ZeroMQ project member
yrashk commented Oct 20, 2011

On the second problem, what's the word size of your erlang installation? 32 bit?

@RomanShestakov

thanks Yurii and Dhammika,

you were right - I had an outdated version of rebar, after update rebar was able to pull all the dependencies and build them correctly.

after that make test for erlzmq started passing as well.

many thanks for your help

Regards, Roman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.