Bug 12700 - Build fails when [ 562/3466] Compiling lib/socket/interfaces.c
Build fails when [ 562/3466] Compiling lib/socket/interfaces.c
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build
4.6.0
x86 FreeBSD
: P5 critical
: ---
Assigned To: Samba QA Contact
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-17 18:46 UTC by samba
Modified: 2017-06-29 07:06 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description samba 2017-03-17 18:46:05 UTC
FreeBSD 8.1

---------------------------------------------
WAF_MAKE=1 python ./buildtools/bin/waf build
Waf: Entering directory `/root/_build/samba/samba-4.6.0/bin'
        Selected embedded Heimdal build
[ 562/3466] Compiling lib/socket/interfaces.c
../lib/socket/interfaces.c: In function '_get_interfaces':
../lib/socket/interfaces.c:203: error: 'IFF_UP' undeclared (first use in this function)
../lib/socket/interfaces.c:203: error: (Each undeclared identifier is reported only once
../lib/socket/interfaces.c:203: error: for each function it appears in.)
../lib/socket/interfaces.c:258: error: 'IFF_BROADCAST' undeclared (first use in this function)
../lib/socket/interfaces.c:258: error: 'IFF_LOOPBACK' undeclared (first use in this function)
../lib/socket/interfaces.c:262: error: 'IFF_POINTOPOINT' undeclared (first use in this function)
Waf: Leaving directory `/root/_build/samba/samba-4.6.0/bin'
---------------------------------------------

Config: 

---------------------------------------------
--enable-debug --docdir=[censored]  --infodir=[censored] 
--mandir=[censored] --enable-fhs --prefix=[censored] 
--exec-prefix=[censored] --with-configdir=[censored] 
--with-piddir=[censored] --without-ad-dc --without-ldap --without-ads
---------------------------------------------
Comment 1 samba 2017-03-17 18:46:35 UTC
P.S. 4.5.* built just fine with the same environment and everything.
Comment 2 samba 2017-04-13 16:35:27 UTC
Same issue with 4.6.2
Comment 3 samba 2017-04-25 20:39:24 UTC
Problem solved by adding the following line:

#include <net/if.h>

to 

lib/socket/interfaces.c


Please do it in your source, guys. It's PITA to do it manually every time.
Comment 4 Volker Lendecke 2017-04-26 15:44:23 UTC
Is it sensible to add a configure check for this? FreeBSD 11 seems to compile fine without it.
Comment 5 samba 2017-04-26 20:58:56 UTC
So far I identified a few more files where that header needs to be included for the compile to work properly. However, I do not see any reason not to do so, because once it's done, the project compiles and works just fine. Also, it 4.5.* compiled just fine as well, so in other words, this bug is a regression.
Comment 6 samba 2017-04-27 00:12:43 UTC
Further research shows that seemingly the variable HAVE_NET_IF_H does not get set by the configure script. When I set it manually by adding the line:

conf.DEFINE('HAVE_NET_IF_H', 1, add_to_cflags=True)

to 'wscript' file at line 93, then everything starts building correctly.

Unfortunately, at this point my knowledge of python doesn't allow me to debug further, i.e. WHY the detection of this header fails. I suspect it has something to do with these lines:

   # these headers need to be tested as a group on freebsd
    conf.CHECK_HEADERS(headers='sys/socket.h net/if.h', together=True)

in 'lib/replace/wscript'.
Interestingly enough, I do not see the lines in the build log that would indicate the detection of these include files, although they are certainly present on my system (I manually checked!)