Post

Compiling msktutil on FreeBSD 8

msktutil is Active Directory keytab manager that you can run on Linux, see home page at http://fuhm.net/software/msktutil/ . To compile it on FreeBSD:

  • Install OpenLDAP client and Cyrus-SASL2 from ports

  • patch ./configure file with:

--- configure.orig      2010-03-16 06:12:42.000000000 +0100
+++ configure   2011-01-01 15:08:23.723972239 +0100
@@ -3919,6 +3919,8 @@

 # Checks for libraries.

+KRB5_LDFLAGS=`/usr/bin/krb5-config --libs 2>/dev/null`
+LIBS="$KRB5_LDFLAGS $LIBS"
 { echo "$as_me:$LINENO: checking for krb5_init_context in -lkrb5" >&5
 echo $ECHO_N "checking for krb5_init_context in -lkrb5... $ECHO_C" >&6; }
 if test "${ac_cv_lib_krb5_krb5_init_context+set}" = set; then
@@ -4073,7 +4075,7 @@
 { echo "$as_me:$LINENO: checking whether com_err.h needs extern \"C\"" >&5
 echo $ECHO_N "checking whether com_err.h needs extern \"C\"... $ECHO_C" >&6; };

-LIBS=-lkrb5
+LIBS="-lkrb5 $LIBS"
 cat >conftest.$ac_ext <<_ACEOF

 #include <com_err.h>
  • patch Makefile.in with:
--- Makefile.in.orig    2010-03-16 06:12:42.000000000 +0100
+++ Makefile.in 2011-01-01 15:04:17.286260778 +0100
@@ -8,7 +8,8 @@
 CPPFLAGS=@CPPFLAGS@
 CXXFLAGS=@CXXFLAGS@ $(WARNFLAGS)
 LDFLAGS=@LDFLAGS@
-LIBS=-lkrb5 -lldap
+KRB5_LDFLAGS=`/usr/bin/krb5-config --libs 2>/dev/null`
+LIBS=-lkrb5 -lldap $(KRB5_LDFLAGS)
 INSTALL=@INSTALL@
 RM=@RM@ -rf
 CP=@CP@ -f
  • patch msktutil.cpp with:
--- old/msktutil-0.4/msktname.cpp       2010-03-16 06:12:42.000000000 +0100
+++ new/msktutil-0.4/msktname.cpp       2010-12-31 13:42:29.725078742 +0100
@@ -26,6 +26,7 @@
  */

 #include "msktutil.h"
+#include <netinet/in.h>


 std::string complete_hostname(const std::string &hostname)
  • run ./configure with following opts:
./configure CPPFLAGS="-I/usr/local/include -I/usr/local/include/sasl" LDFLAGS="-L/usr/local/lib"
  • run gmake