Loading...
 

shimpsblog [en]

Compiling GnuPG IX: Dependencies II

fmg Saturday March 22, 2025

Situation

Last time we compiled the libraries and GnuPG itself by invoking the classic method ./configure, make and make install with an additional configure option. That resulted in a first success. Now we try a different method by using a different makefile.

Installation destination path

This time we choose the relative installation path native and the absolute path /tmp/canary/native.

Copy to clipboard
$ pwd /tmp/canary/compile/gnupg-2.5.5 $ mkdir /tmp/canary/native

Compiling

Using the speedo.mk makefile it is possible to utilize the shipped all inclusive option with the make target native. The needed libraries will be downloaded and compiled by the makefile. There is no need to resolve dependency conflicts manually. But the build environment needs the Debian package patchelf to be installed. This tool helps to generate a more portable version of the binaries.

Copy to clipboard
make -f build-aux/speedo.mk native make -f build-aux/speedo.mk install SYSROOT=/tmp/canary/native

The smoke test

Copy to clipboard
$ /tmp/canary/native/bin/gpg --version gpg (GnuPG) 2.5.5 libgcrypt 1.11.0 Copyright (C) 2025 g10 Code GmbH License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Home: /home/alice/.gnupg Supported algorithms: Pubkey: RSA, Kyber, ELG, DSA, ECDH, ECDSA, EDDSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB

The environment variable LD_LIBRARY_PATH is not needed. The information about the location of libraries is taken from a configuration file which is installed next to the gpg binary.

Copy to clipboard
$ grep rootdir /tmp/canary/native/bin/gpgconf.ctl rootdir = /tmp/canary/native

The binaries are almost out of the box portable. When you move everything from /tmp/canary/native/* to another path /tmp/newlocation it should be sufficient to adjust the rootdir line in the file gpgconf.ctl to rootdir = /tmp/newlocation.

Copy to clipboard
mkdir /tmp/newlocation mv /tmp/canary/native/* /tmp/newlocation sed -i -e 's/tmp\/canary\/native/tmp\/newlocation/' \\ /tmp/newlocation/bin/gpgconf.ctl


To be continued...