FreeBSD/KnotDNS/makeについて、ここに記述してください。

/gcc

32bit OSだとこういうトラブルもある。

https://www.mail-archive.com/knot-dns-users@lists.nic.cz/msg00585.html

https://www.knot-dns.cz/docs/2.4/html/installation.html

Knot DNS build system relies on these standard tools:
    make
    libtool
    autoconf >= 2.65

1. Required libraries

libknotを作るだけなので、気にしなくてもいいのかも。

Knot DNS requires few libraries to be compiled:

    GnuTLS, at least 3.3
    Jansson, at least 2.3
    Userspace RCU, at least 0.5.4
    libedit
    lmdb (included)
    libcap-ng, at least 0.6.4 (optional)
    libidn (optional)
    libsystemd (optional)
    protobuf-c and fstrm (optional)

2. config

/config-diff

Making all in libtap
Making all in src
make  all-recursive
Making all in zscanner
cp ./scanner.c.g2 scanner.c
NOTE: Compilation of scanner.c can take several minutes!
make  all-am
  CC       libzscanner_la-error.lo
  CC       libzscanner_la-functions.lo
  CC       libzscanner_la-scanner.lo
...
In file included from /usr/local/include/gnutls/abstract.h:29,
                 from shared/pem.c:18:
/usr/local/include/gnutls/openpgp.h:327: warning: 'gnutls_openpgp_recv_key_func' is deprecated
...

Making all in .
  CC       libknot/libknot_la-binary.lo
  CC       libknot/libknot_la-codes.lo
  CC       libknot/control/libknot_la-control.lo
  CC       libknot/cookies/libknot_la-alg-fnv64.lo
  CC       libknot/cookies/libknot_la-client.lo
  CC       libknot/cookies/libknot_la-server.lo
  CC       libknot/libknot_la-descriptor.lo
  CC       libknot/libknot_la-dname.lo
  CC       libknot/libknot_la-error.lo
  CC       libknot/db/libknot_la-db_lmdb.lo
  CC       libknot/db/libknot_la-db_trie.lo
  CC       libknot/packet/libknot_la-compr.lo
In file included from libknot/packet/compr.c:22:
./libknot/packet/pkt.h:97: error: redefinition of typedef 'knot_pkt_t'
./libknot/rrtype/opt.h:33: error: previous declaration of 'knot_pkt_t' was here
*** Error code 1

Stop.
make[3]: stopped in /usr/home/tmaeno/knot-2.4.3/src
*** Error code 1

3. patch

%diff -c pkt.h*                           ~/knot-2.4.3/src/libknot/packet
*** pkt.h       2017-05-12 10:04:04.685086000 +0900
--- pkt.h.orig  2017-04-11 20:37:11.000000000 +0900
***************
*** 64,70 ****
  /*!
   * \brief Structure representing a DNS packet.
   */
! struct knot_pkt {
  
        uint8_t *wire;         /*!< Wire format of the packet. */
        size_t size;           /*!< Current wire size of the packet. */
--- 64,70 ----
  /*!
   * \brief Structure representing a DNS packet.
   */
! typedef struct knot_pkt {
  
        uint8_t *wire;         /*!< Wire format of the packet. */
        size_t size;           /*!< Current wire size of the packet. */
***************
*** 94,100 ****
        knot_rrset_t *rr;
  
        knot_mm_t mm; /*!< Memory allocation context. */
! } ;
  
  /*!
   * \brief Create new packet over existing memory, or allocate new from memory context.
--- 94,100 ----
        knot_rrset_t *rr;
  
        knot_mm_t mm; /*!< Memory allocation context. */
! } knot_pkt_t;
  
  /*!
   * \brief Create new packet over existing memory, or allocate new from memory context.

4. nameserver/query_module.h

  CCLD     kjournalprint
./.libs/libknotd.a(libknotd_la-rrl.o): In function `mod_ctr_incr':
/usr/home/tmaeno/knot-2.4.3/src/./knot/nameserver/query_module.h:144:
 undefined reference to `__sync_fetch_and_add_8'

OS(LLVMとgccと)の違いに由来か。man atomic(9)

NAME
     atomic_add, atomic_clear, atomic_cmpset, atomic_fetchadd, atomic_load,
     atomic_readandclear, atomic_set, atomic_subtract, atomic_store  atomic
     operations

4.1. Ubuntu

config.log

#define HAVE_ATOMIC 1

4.2. patch

型不一致の警告はでる。

%diff -c query_module.h.orig query_module.h
*** query_module.h.orig 2017-04-11 20:37:11.000000000 +0900
--- query_module.h      2017-05-12 18:27:11.316725000 +0900
***************
*** 46,54 ****
  #include "knot/nameserver/internet.h"
  #include "contrib/ucw/lists.h"
  
  #ifdef HAVE_ATOMIC
!  #define ATOMIC_ADD(dst, val) __atomic_add_fetch(dst, val, __ATOMIC_RELAXED);
!  #define ATOMIC_SUB(dst, val) __atomic_sub_fetch(dst, val, __ATOMIC_RELAXED);
  #else
   #define ATOMIC_ADD(dst, val) __sync_fetch_and_add(dst, val);
   #define ATOMIC_SUB(dst, val) __sync_fetch_and_sub(dst, val);
--- 46,57 ----
  #include "knot/nameserver/internet.h"
  #include "contrib/ucw/lists.h"
  
+ #include <sys/types.h>
+ #include <machine/atomic.h>
+ 
  #ifdef HAVE_ATOMIC
!  #define ATOMIC_ADD(dst, val) atomic_add_ptr(dst, val);
!  #define ATOMIC_SUB(dst, val) atomic_subtract_ptr(dst, val);
  #else
   #define ATOMIC_ADD(dst, val) __sync_fetch_and_add(dst, val);
   #define ATOMIC_SUB(dst, val) __sync_fetch_and_sub(dst, val);