zeromq / rbzmq

Ruby binding for 0MQ

Home Page:http://www.zeromq.org/bindings:ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem w/ 64bit build on Mac OS X under snowleopard.

jasonmcmunn opened this issue · comments

Built 2.0.10 with no issues. It only built the x86_64 version, not i386, which was fine with me, no use for the i386 version.

woot:zeromq-2.0.10 mcmunn$ sudo gem install zmq -- --with-zmq-dir=/usr/local
Password:
Building native extensions. This could take a while...
ERROR: Error installing zmq:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-zmq-dir=/usr/local
checking for zmq_init() in -lzmq... no
extconf.rb:25: Couldn't find zmq library. try setting --with-zmq-dir= to tell me where it is. (RuntimeError)

Library was fine, built a quick C client/server with no problems.

Tried to run it manually and got a similar error.

Checked the log:

bash-3.2# ruby extconf.rb --with-zmq-dir=/usr/local
checking for zmq_init() in -lzmq... no
extconf.rb:25: Couldn't find zmq library. try setting --with-zmq-dir= to tell me where it is. (RuntimeError)
bash-3.2# cat *log
have_library: checking for zmq_init() in -lzmq... -------------------- no

"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I/usr/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -L. -arch i386 -arch x86_64 -lruby -lzmq -lpthread -ldl "
conftest.c: In function ‘t’:
conftest.c:3: error: ‘zmq_init’ undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
conftest.c: In function ‘t’:
conftest.c:3: error: ‘zmq_init’ undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
lipo: can't figure out the architecture type of: /var/tmp//ccc3JRtV.out
checked program was:
/* begin /
1: /top/
2: int main() { return 0; }
3: int t() { void ((volatile p)()); p = (void (()()))zmq_init; return 0; }
/
end */

"gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I/usr/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -L. -arch i386 -arch x86_64 -lruby -lzmq -lpthread -ldl "
ld: warning: in /usr/local/lib/libzmq.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_zmq_init", referenced from:
_t in ccc6CqbX.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//ccYS6JqC.out (No such file or directory)
checked program was:
/* begin /
1: /top/
2: int main() { return 0; }
3: int t() { zmq_init(); return 0; }
/
end */


So I forced x86_64 and it built fine:

bash-3.2# env ARCHFLAGS="-arch x86_64" ruby extconf.rb --with-zmq-dir=/usr/local
checking for zmq_init() in -lzmq... yes
Cool, I found your zmq install...
creating Makefile
bash-3.2# id
uid=0(root) gid=0(wheel) groups=0(wheel),401(com.apple.access_screensharing),402(com.apple.sharepoint.group.1),204(_developer),100(_lpoperator),98(_lpadmin),80(admin),61(localaccounts),29(certusers),20(staff),12(everyone),9(procmod),8(procview),5(operator),4(tty),3(sys),2(kmem),1(daemon)
bash-3.2# make
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I/usr/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c rbzmq.c
cc -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o zmq.bundle rbzmq.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/usr/local/lib -L. -arch x86_64 -lruby -lzmq -lpthread -ldl
bash-3.2# make install
/usr/bin/install -c -m 0755 zmq.bundle /Library/Ruby/Site/1.8/universal-darwin10.0

I think you'll either have to rebuild libzmq as a universal binary, or modify the zmq gem to build x86_64 only and install it manually.