Skip Menu |

From: "Xiaoyi Wu" <>
Date: Mon, 29 Mar 2021 23:30:58 +0000 (UTC)
To: "" <>
Subject: compiling krb5 static library
Download (untitled) / with headers
text/plain 2.8KiB

I downloaded krb5-1.19.1.tar.gz, and was trying to compile the static library from it.  In the src sub-directory, I issued these two commands:

$ configure --enable-static --disable-shared
$ make

The second command failed with these output:

making all in kadmin/dbutil...
make[2]: Entering directory '/home/wxy/lima/build/krb5-1.19.1/src/kadmin/dbutil'
gcc -L../../lib -Wl,--enable-new-dtags -Wl,-rpath -Wl,/usr/local/lib -g -O2   -o kdb5_util kdb5_util.o kdb5_create.o kadm5_create.o kdb5_destroy.o kdb5_stash.o import_err.o strtok.o dump.o ovload.o kdb5_mkey.o tabdump.o tdumputil.o ../cli/getdate.o -lkadm5srv_mit  -lkdb5 -lkrb5_db2 -lkadm5srv_mit -lgssrpc -lgssapi_krb5 -lgssrpc -lgssapi_krb5 -ldl -pthread  -lkrb5 -lk5crypto -lcom_err -lkrb5support  -lresolv  -ldl
/usr/bin/ld: ../../lib/libkadm5srv_mit.a(server_kdb.o):/home/wxy/lima/build/krb5-1.19.1/src/lib/kadm5/srv/server_kdb.c:18: multiple definition of `master_keyblock'; kdb5_util.o:/home/wxy/lima/build/krb5-1.19.1/src/kadmin/dbutil/kdb5_util.c:109: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:664: kdb5_util] Error 1
make[2]: Leaving directory '/home/wxy/lima/build/krb5-1.19.1/src/kadmin/dbutil'
make[1]: *** [Makefile:866: all-recurse] Error 1
make[1]: Leaving directory '/home/wxy/lima/build/krb5-1.19.1/src/kadmin'
make: *** [Makefile:1554: all-recurse] Error 1

However, there is a work around.  If I configure and compile the default dynamic library first, then re-configure and compile the static library, it will be successful.  The following command sequence will work fine:

$ configure
$ make
$ configure --enable-static --disable-shared
$ make

The environment is Fedora 33:

$ uname -a
Linux dark1 5.11.10-200.fc33.x86_64 #1 SMP Thu Mar 25 16:51:31 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl= --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20201125 (Red Hat 10.2.1-9) (GCC) 

Hope someone will fix the issue for future releases.

Xiaoyi Wu