Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nanomsg support #53

Closed
romix opened this issue Apr 6, 2014 · 13 comments
Closed

nanomsg support #53

romix opened this issue Apr 6, 2014 · 13 comments

Comments

@romix
Copy link

romix commented Apr 6, 2014

Richard,

You've experimented with ZeroMQ already. May be nanomsg could be used instead of ZeroMQ?

nanomsg claims to be nextgen ZeroMQ, fully POSIX API compliant, faster, written in C, MIT-licensed. And there are a few Lua bindings available.

@richardhundt
Copy link
Owner

On 4/7/14 12:04 AM, romix wrote:

Richard,

You've experimented with ZeroMQ already. May be nanomsg could be used
instead of ZeroMQ?

Hell, I clearly haven't been paying attention. Yeah. This is exactly
what I need. Small, clean, fast and written by the same guy.

ZeroMQ is already out of Shine anyway (the bindings are in a separate
github repo now). Nanomsg will solve my threading library (I can ditch
that stoopid Pipe implementation now).

Thanks for this.

@romix
Copy link
Author

romix commented Apr 7, 2014

You're welcome! :-)

@richardhundt
Copy link
Owner

Initial support for nanomsg is in and integrated into the event loop. So nanomsg sockets can be mixed with regular sockets, and fibers as well as threads and nothing should block.

@romix
Copy link
Author

romix commented Apr 7, 2014

Cool! Thanks!

But it does not build for me:

../boot/bin/shnc  -n "sys.thread"    sys/thread.shn   shine/build/sys_thread.o
../boot/bin/shnc  -n "sys.nanomsg"   sys/nanomsg.shn   shine/build/sys_nanomsg.o
tvmjit: .../shine/boot/src/shnc.raw:0: sys/nanomsg.shn: No such file or directory
stack traceback:
    [C]: in function 'assert'
    ...shine/boot/src/shnc.raw: in function 'start'
    ../boot/bin/shnc:2: in main chunk
    [C]: at 0x0100001680
make[1]: *** [shine/build/libs/sys.so] Error 1

@richardhundt
Copy link
Owner

On 4/7/14 9:23 PM, romix wrote:

Cool! Thanks!

But it does not build for me:

|../boot/bin/shnc -n "sys.thread" sys/thread.shn shine/build/sys_thread.o
../boot/bin/shnc -n "sys.nanomsg" sys/nanomsg.shn shine/build/sys_nanomsg.o
tvmjit: .../shine/boot/src/shnc.raw:0: sys/nanomsg.shn: No such file or directory
stack traceback:
[C]: in function 'assert'
...shine/boot/src/shnc.raw: in function 'start'
../boot/bin/shnc:2: in main chunk
[C]: at 0x0100001680
make[1]: *** [shine/build/libs/sys.so] Error 1
|


Reply to this email directly or view it on GitHub
#53 (comment).

Try now?

@romix
Copy link
Author

romix commented Apr 7, 2014

Yep. Works :-)

@richardhundt
Copy link
Owner

forgot to push earlier :(

@dvv
Copy link

dvv commented Aug 26, 2014

notice that it does require to be compiled with -fPIC, or shine doesn't build

../boot/bin/shinec  -n "net.nanomsg" net/nanomsg.shn /home/dvv/projects/LUA/shine/build/net_nanomsg.o
cc -O2 -Wall -shared -fPIC -o /home/dvv/projects/LUA/shine/build/libs/net.so -lm -ldl \
/home/dvv/projects/LUA/shine/build/net_socket.o /home/dvv/projects/LUA/shine/build/net_http.o /home/dvv/projects/LUA/shine/build/net_uri.o \
/home/dvv/projects/LUA/shine/build/net_nanomsg.o  -Wl,--whole-archive /home/dvv/projects/LUA/shine/build/libnanomsg.a  -Wl,--no-whole-archive -Wl,-E
/usr/bin/ld: /home/dvv/projects/LUA/shine/build/libnanomsg.a(ep.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/dvv/projects/LUA/shine/build/libnanomsg.a(ep.o): error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:58: recipe for target '/home/dvv/projects/LUA/shine/build/libs/net.so' failed

I had to patch lib/Makefile

${DEPDIR}/nanomsg/Makefile:
  cd ${DEPDIR}/nanomsg && ./autogen.sh && CFLAGS='$(CFLAGS) -fPIC ' ./configure --prefix=${BUILD} --with-pic

to fix that.

[dvv@pagocmb lib]$ uname -a
Linux pagocmb 3.15.5-2-ARCH #1 SMP PREEMPT Fri Jul 11 07:56:02 CEST 2014 x86_64 GNU/Linux
[dvv@pagocmb lib]$ gcc --version
gcc (GCC) 4.9.1

@richardhundt
Copy link
Owner

I've bumped nanomsg submodule in master and it doesn't seem to be a problem on my ubuntu VM. Could you check if this patch is still needed?

@dvv
Copy link

dvv commented Aug 27, 2014

will do. is there any nanomsg sample btw?

@richardhundt
Copy link
Owner

@dvv
Copy link

dvv commented Aug 27, 2014

cloned afresh. still

cc -O2 -Wall -shared -fPIC -o /home/dvv/projects/LUA/shine/build/libs/net.so -lm -ldl -pthread \
/home/dvv/projects/LUA/shine/build/net_socket.o /home/dvv/projects/LUA/shine/build/net_http.o /home/dvv/projects/LUA/shine/build/net_uri.o \
/home/dvv/projects/LUA/shine/build/net_nanomsg.o  -Wl,--whole-archive /home/dvv/projects/LUA/shine/build/libnanomsg.a  -Wl,--no-whole-archive -Wl,-E -lrt -lanl
/usr/bin/ld: /home/dvv/projects/LUA/shine/build/libnanomsg.a(libnanomsg_la-ep.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/dvv/projects/LUA/shine/build/libnanomsg.a(libnanomsg_la-ep.o): error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:58: recipe for target '/home/dvv/projects/LUA/shine/build/libs/net.so' failed

@dvv
Copy link

dvv commented Aug 27, 2014

CFLAGS='$(CFLAGS) -fPIC ' 

is needed, seems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants