Subject: | Building 1.18.3 on OpenBSD 6.8 amd64 |
To: | "krb5-bugs@mit.edu" <krb5-bugs@mit.edu> |
From: | "Robert Crowston" <crowston@protonmail.com> |
Date: | Sat, 21 Nov 2020 16:32:48 +0000 |
(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.
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.