[krbdev.mit.edu #8968] Building 1.18.3 on OpenBSD 6.8 amd64

Robert Crowston via RT rt-comment at krbdev.mit.edu
Sat Nov 21 13:19:25 EST 2020


Sat Nov 21 13:19:25 2020: Request 8968 was acted upon.
 Transaction: Ticket created by crowston at protonmail.com
       Queue: krb5
     Subject: Building 1.18.3 on OpenBSD 6.8 amd64
       Owner: Nobody
  Requestors: crowston at protonmail.com
      Status: new
 Ticket <URL: https://krbdev.mit.edu/rt/Ticket/Display.html?id=8968 >


(Apologies if this is the wrong list for reporting bugs. Please redirect me to the right list if I am here in error.)

I had to make some changes to the sources to build krb5-1.18.3 on my system.

$ uname -a
OpenBSD virt-openbsd.xxx 6.8 GENERIC.MP#1 amd64

Firstly, gcc on OpenBSD is 4.2.1, now very elderly. By default, ./configure uses gcc if it finds it, but I was not able to compile using gcc. Instead, I used clang, which is the supported compiler for OpenBSD on amd64 and available as 'cc'.

./configure CC=cc CXX=c++

I suggest that ./configure be changed to use clang by default on OpenBSD.

Secondly, ld on OpenBSD amd64 is now ld.lld, the llvm linker, not ld the GNU linker.

$ ld --version
LLD 10.0.1 (compatible with GNU linkers)

For whatever reason, when invoking ld directly, it is not able to find the default libraries in /usr/lib. Instead I modified the shlib.conf script to use the clang driver to run the linker.

--- /dev/fd/11  Sat Nov 21 16:08:26 2020
+++ src/config/shlib.conf  Sat Nov 21 12:57:34 2020
@@ -340,7 +340,7 @@
        PICFLAGS=-fpic
        SHLIBVEXT='.so.$(LIBMAJOR).$(LIBMINOR)'
        SHLIBEXT=.so
-       LDCOMBINE='ld -Bshareable'
+       LDCOMBINE='$(CC) -shared -fPIC -Wl,-h,$(LIBPREFIX)$(LIBBASE)$(SHLIBVEXT)'
        SHLIB_RPATH_FLAGS='-R$(SHLIB_RDIRS)'
        SHLIB_EXPFLAGS='$(SHLIB_RPATH_FLAGS) $(SHLIB_DIRS) $(SHLIB_EXPLIBS)'
        RPATH_FLAG=-R

I suggest that patch be implemented; there is not a lot of reason to support older versions of OpenBSD.

Thirdly, util/verto expects to be able to link against libm, the math library. However, on OpenBSD, the math functions are part of the native C library and there is no libm. I was able to resolve this by removing lm from SHLIB_EXPLIBS:

--- /dev/fd/11  Sat Nov 21 16:12:43 2020
+++ src/util/verto/Makefile.in      Sat Nov 21 12:05:30 2020
@@ -19,7 +19,7 @@
        $(OUTPRE)verto-k5ev.$(OBJEXT)
 SRCS=verto.c module.c verto-k5ev.c

-SHLIB_EXPLIBS= $(LIBS) -lm    # libm needed for ceil() currently.
+SHLIB_EXPLIBS= $(LIBS)

 VERTO_HDR=$(BUILDTOP)$(S)include$(S)verto.h

Indeed I believe that OpenBSD is not the only operating system to bundle the math libraries with libc. Therefore I propose that ./configure should detect whether ceil() can be invoked without -lm and only append -lm for platforms that require it.

Fourthly, pkinit seems incompatible with libressl, OpenBSD's replacement for openssl; we are missing some symbols such as OBJ_get0_data() and X509_get_key_usage(). I found that surprising, but I have no use for pkinit so in lieu of investigating I disabled it at configure time.

./configure CC=cc CXX=c++ --disable-pkinit

Until pkinit is properly fixed I suggest --disable-pkinit become the default on OpenBSD.

With these four minor changes I was able to build and install MIT Kerberos 5 1.18.3 on my OpenBSD system. Thank you for your work on this product.

— RHC.





More information about the krb5-bugs mailing list