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

libzmq static linking is giving problem in GO SDK. #2849

Closed
jay11ca39 opened this issue Nov 24, 2017 · 4 comments
Closed

libzmq static linking is giving problem in GO SDK. #2849

jay11ca39 opened this issue Nov 24, 2017 · 4 comments

Comments

@jay11ca39
Copy link

I am using pebbe [zmq4] go zeroMQ library which is written on the top of libzmq.

I was trying to link static library of library:
CGO_LDFLAGS+='-lstdc++ -lm ' CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-extldflags "-static" -v' sample.go

But, i got the following error in libzmq:

# command-line-arguments
HEADER = -H4 -T0x8049000 -D0x0 -R0x1000
searching for runtime.a in $WORK/runtime.a
 0.00 deadcode
 0.06 pclntab=927798 bytes, funcdata total 202599 bytes
 0.06 dodata
 0.08 dwarf
 0.10 symsize = 0
 0.15 reloc
 0.17 asmb
 0.18 datblk
 0.19 sym
 0.19 elfsym
 0.19 symsize = 132464
 0.20 symsize = 133744
 0.21 headr
 0.31 host link: "gcc" "-m32" "-gdwarf-2" "-o" "/tmp/go-build291054915/command-line-arguments/_obj/exe/a.out" "-static" "/tmp/go-link-468758464/go.o" "/tmp/go-link-468758464/000000.o" "/tmp/go-link-468758464/000001.o" "/tmp/go-link-468758464/000002.o" "-lstdc++" "-lm" "-L/usr/local/lib" "-lzmq" "-lstdc++" "-lm" "-lpthread" "-lstdc++" "-lm" "-no-pie" "-static"
/usr/local/lib/libzmq.a(src_libzmq_la-ipc_listener.o): In function `zmq::ipc_listener_t::filter(int)':
/home/jay/2017/edgeX_foundry/EMF/static_shared_go/dependencies/libzmq/src/ipc_listener.cpp:350: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jay/2017/edgeX_foundry/EMF/static_shared_go/dependencies/libzmq/src/ipc_listener.cpp:346: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-468758464/000002.o: In function `_cgo_b0c710f30cfd_C2func_getaddrinfo':
/tmp/go-build/net/_obj/cgo-gcc-prolog:45: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
 2.52 cpu time
98591 symbols
128260 liveness data

Please help me if any body has tried or is have saw such kind of error.

@jay11ca39
Copy link
Author

Hello @bluca ,
I am not sure whether it is pebbe library issue or in libzmq building I missed some flags.
Can you please help me in this.
Thanks in advance.

@jay11ca39
Copy link
Author

Hello @bluca ,
Can you please let me know, Are there some flags those needs to be add to libzmq building ?
Because in this case glibc needs to be statically linked..

Can you provide your opinion on this?

@bluca
Copy link
Member

bluca commented Nov 27, 2017

You cannot statically link to glibc - it uses runtime plugins for things like DNS resolution.
Also it's licensed under the LGPL, which means you can do dynamic linking, but static linking means your program's source code also has to be released under the LGPL.

Besides that, it looks like a problem with Golang, by searching for that error on google this is the second result:

golang/go#21421

@bluca
Copy link
Member

bluca commented Mar 24, 2018

No updates and problem seemed unrelated to libzmq, closing

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

No branches or pull requests

3 participants