Open jay11ca39 opened 6 years ago
try the following:
CGO_CPPFLAGS="-I/usr/include" CGO_LDFLAGS="-L/usr/lib -L/usr/lib/x86_64-linux-gnu -lzmq -lpthread -lsodium -lrt -lstdc++ -lm -lc -lgcc" go build -v --ldflags '-extldflags "-static"' -a subscriber.go
change directories accordingly, if necessary.
This should be added to the README as it might be helpful for many people!
Hi @pebbe , In my project, I use zmq4 that provides binding for c++ libzmq library. I want to link statically to reduce dependence.
I have successfully built libzmq to build static library:
./configure --disable-shared --enable-static LDFLAGS=-lstdc++
But when i am trying to build my go sample using the below command:
CGO_LDFLAGS+='-lstdc++ -lm' CGO_ENABLED=1 GOOS=linux go build -a --ldflags '-extldflags "-static" -v' subscriber.go
t is giving the following:
Is any flag is missed in go sample building?