[zeromq-dev] Linking 0MQ Completely Static on Linux

Subin Sebastian subinsebastien at gmail.com
Mon Sep 28 07:35:28 CEST 2020

Problem: With only package managers on Ubuntu, it does not seem to be
possible to compile zero-MQ into an application completely statically.

However, I'm able to checkout the source code from github, and compile the
library with --static-enabled and --dynamic disabled to get the statically
built library file, which in turn, I'm able to compile into my application
program statically. That solution is working fine for me. However, I don't
like the complexity involved in source checkout, compiling from source and

Here is an illustration of the problem.The test program is from the zeromq

*subin at linux:~/zmq-test$ g++ zmq-test.cpp `pkg-config --static --libs
--cflags libzmq`subin at linux:~/zmq-test$ file a.out a.out: ELF 64-bit LSB
pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter
BuildID[sha1]=eee33d81fbf590427a3f3b99fbe7dc5c1b00f233, for GNU/Linux
3.2.0, not strippedsubin at linux:~/zmq-test$ g++ -static zmq-test.cpp
`pkg-config --static --libs --cflags libzmq`/usr/bin/ld: cannot find
-lgssapi_krb5/usr/bin/ld: cannot find -lkrb5/usr/bin/ld: cannot find
-lk5crypto/usr/bin/ld: cannot find -lkrb5supportcollect2: error: ld
returned 1 exit status*
*subin at linux:~/zmq-test$*

Looks like these dependencies are not available on the package archives.
Is that the correct assumption?

Sent from My iPhone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200928/8af56f99/attachment.htm>

More information about the zeromq-dev mailing list