Bug 2603 - Build with ldns and without kerberos support fails if ldns compiled with kerberos support
Summary: Build with ldns and without kerberos support fails if ldns compiled with kerb...
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Kerberos support (show other bugs)
Version: 7.3p1
Hardware: amd64 Linux
: P5 normal
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_7_5
  Show dependency treegraph
 
Reported: 2016-08-03 22:30 AEST by Ondrej Caletka
Modified: 2018-04-06 12:26 AEST (History)
2 users (show)

See Also:


Attachments
use ldns-config if possible (2.38 KB, patch)
2017-02-03 15:04 AEDT, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ondrej Caletka 2016-08-03 22:30:03 AEST
I'm trying to build openssh-7.3 like this:

$ ./configure --with-ldns
$ make
â¦
(cd openbsd-compat && make)
make[1]: Entering directory '/hdhome/oskar/Downloads/openssh-7.3p1/openbsd-compat'
gcc -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -ftrapv -fno-builtin-memset -fstack-protector-strong -fPIE  -I. -I.. -I. -I./..  -DHAVE_CONFIG_H -c getrrsetbyname-ldns.c
In file included from ../openbsd-compat/openbsd-compat.h:173:0,
                 from ../includes.h:171,
                 from getrrsetbyname-ldns.c:46:
../openbsd-compat/bsd-misc.h:139:39: error: expected identifier or '(' before 'do'
 # define krb5_free_error_message(a,b) do { } while(0)
                                       ^
../openbsd-compat/bsd-misc.h:139:46: error: expected identifier or '(' before 'while'
 # define krb5_free_error_message(a,b) do { } while(0)
                                              ^
Makefile:26: recipe for target 'getrrsetbyname-ldns.o' failed

The reason seem to be that ldns itself is compiled with kerberos support and when including the <ldns/ldns.h>, the prototype of real function krb5_free_error_message() is broken by the previous macro definition in openbsd-compat/bsd-misc.h.

I've found out that this can be worked around by reordering the includes in openbsd-compat/getrrsetbyname-ldns.c so the <ldns/ldns.h> is included before the "includes.h". Other workaround is to compile openssh with kerberos support or without ldns support, obviously.
Comment 1 Damien Miller 2017-02-03 15:04:47 AEDT
Created attachment 2937 [details]
use ldns-config if possible

We could probably fix this using ldns-config if it is installed. That *should* suggest the correct libraries to link against.
Comment 2 Damien Miller 2017-02-03 16:04:28 AEDT
Fixed in:

commit 523db8540b720c4d21ab0ff6f928476c70c38aab
Author: Damien Miller <djm@mindrot.org>
Date:   Fri Feb 3 16:01:22 2017 +1100

    prefer to use ldns-config to find libldns
    
    Should fix bz#2603 - "Build with ldns and without kerberos support
    fails if ldns compiled with kerberos support" by including correct
    cflags/libs
    
    ok dtucker@
Comment 3 Damien Miller 2018-04-06 12:26:30 AEST
Close all resolved bugs after release of OpenSSH 7.7.