Howto build GnuPG 2.1.18 and up without dynamic linking

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Feb 10 19:51:25 CET 2017


Hi lugarius--

On Thu 2017-02-09 13:34:05 -0500, lugarius at riseup.net wrote:

> I am a young programmer and I'd like to learn how to compile Gpg 
> complete static on any Linux machine
> (in some kind of sandbox so that the instructions are the same on every 
> distribution).
>
> I tried it by setting on every compilation the CFLAGS to “-static” but 
> it resulted with an error.
> What I learn here gets blogged so others don't have to ask again.
> (I only need the gpg2 binary if it helps to cut out some dependencies)

If you're interested, you might take a look at the debian packaging,
which builds "gpgv-static" with basically the same goals that you have:

  https://sources.debian.net/src/gnupg2/2.1.18-4/debian/rules/

sorry that the rules file there is a little hard to read, it's trying to
be clever, taking advantage of debian infrastructure, and then trying to
build something useful cross-platform.

The main distinction between gpgv-static and the minimalist gpgv built
for udeb (debian installer use) is just the use of the -static option in
LDFLAGS:

 https://sources.debian.net/src/gnupg2/2.1.18-4/debian/rules/#L45

hth,

        --dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: </pipermail/attachments/20170210/82457aa5/attachment.sig>


More information about the Gnupg-devel mailing list