Bug 9286 - Configure doesn't try to detect byteswap.h
Summary: Configure doesn't try to detect byteswap.h
Status: NEW
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.0.0rc2
Hardware: All Other
: P5 normal (vote)
Target Milestone: ---
Assignee: Rusty Russell
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-12 16:53 UTC by René Berber
Modified: 2013-11-01 23:00 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description René Berber 2012-10-12 16:53:55 UTC
Build environment: Cygwin (latest), gcc 4.5.3

Running configure doesn't try to detect header byteswap.h, then building fails with:

[ 541/3345] Compiling lib/ntdb/check.c
../lib/ntdb/check.c:1:0: warning: -fPIC ignored for target (all code is position independent)
In file included from ../lib/ntdb/private.h:28:0,
                 from ../lib/ntdb/check.c:18:
../lib/ccan/endian/endian.h:18:24: error: redefinition of 'bswap_16'
/usr/include/byteswap.h:19:1: note: previous definition of 'bswap_16' was here
../lib/ccan/endian/endian.h:32:24: error: redefinition of 'bswap_32'
/usr/include/byteswap.h:25:1: note: previous definition of 'bswap_32' was here
../lib/ccan/endian/endian.h:51:24: error: redefinition of 'bswap_64'
/usr/include/byteswap.h:31:1: note: previous definition of 'bswap_64' was here
Waf: Leaving directory `/home/rberber/samba-4.0.0rc2/bin'
Build failed:  -> task failed (err #1):
        {task: cc check.c -> check_1.o}
Makefile:7: recipe for target `all' failed


The point of failure is guarded by:

#if HAVE_BYTESWAP_H
#include <byteswap.h>
#else
...

but HAVE_BYTESWAP_H was never defined.
Comment 1 René Berber 2012-10-12 17:06:04 UTC
Add HAVE_BSWAP_64 to the variables that need a test and be defined.
Comment 2 Björn Jacke 2012-10-13 11:54:44 UTC
rusty, you should make sure that the defines that you use in ccan are being set in configure
Comment 3 Rusty Russell 2013-11-01 23:00:17 UTC
Huh, waf *should* detect this:

lib/ccan/wscript:
    conf.CHECK_HEADERS('byteswap.h')

That should set HAVE_BYTESWAP_H.  That's been there for a year:

commit 029654897d721308c9ee782aee420abddce7edee
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Sun Oct 14 16:05:58 2012 +1030

    ccan: check for all the used config.h defines
    
    In particular, not checking for byteswap.h meant we defined duplicates:
    https://bugzilla.samba.org/show_bug.cgi?id=9286
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    
    Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
    Autobuild-Date(master): Wed Oct 17 01:55:14 CEST 2012 on sn-devel-104