WAF 2.x broken a lot of configure checks
Alexander Bokovoy
ab at samba.org
Thu Sep 6 10:40:08 UTC 2018
On ke, 05 syys 2018, Alexander Bokovoy via samba-technical wrote:
> > > These two are coming from heimdal explicitly setting them to '0':
> > > conf.define('HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE', 0)
> > > conf.define('HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER', 0)
> > >
> > >>>>
> > >>>> and now I have this:
> > >>>>
> > >>>> less bin/c4che/default_cache.py | grep '= 0'
> > >>>> HAVE_BSD_STRTOLL = 0
> > >>>> HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE = 0
> > >>>> HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER = 0
> > >>>> HAVE_INCOHERENT_MMAP = 0
> > > .. and both HAVE_BSD_STRTOLL and HAVE_INCOHERENT_MMAP are defined using
> > > conf.CHECK_CODE() which passes 'None' to conf.define().
> > >
> > > So I think my proposed patch would cover these two.
> > >
> > > I'm not sure we want to change heimdal's definitions.
> >
> > Maybe.
> >
> > Can you try yours and compare the result of bin/c4che/default.cache.py
> > with the result of bin/c4che/default_cache.py on a Linux system
> > and a FreeBSD 11 system?
> >
> > It seems my fix only covert the BSD_STROLL thing on Linux,
> > but FreeBSD still has HAVE_WORKING_STRPTIME = 0.
> Well, my FreeBSD 11.2 fails working strptime test. If I force printing
> from the test function, I get under locale C:
>
> $ ./mmtest-strptime
> test: strptime
> failure: strptime [
> tm_wday: expected: 6, got: 5
> ]
>
> So it indeed is failing and is not working.
I fixed detection of this case. In general, a change is that even when
test is failing, the define is set. We have at least three defines which
tested with '#ifdef'/'#ifndef' instead of '#if' so for them always-set
defines mean that '#ifdef' always succeeds.
Because of that, aside from HAVE_WORKING_STRPTIME and
HAVE_INCOHERENT_MMAP we were failing with HAVE_FALLTHROUGH_ATTRIBUTE:
-----------------------------------------------------------
$ make
WAF_MAKE=1 python ./buildtools/bin/waf build
Waf: Entering directory `/usr/home/ab/src/samba/bin/default'
Selected embedded Heimdal build
[145/146] Compiling lib/replace/strptime.c
../lib/replace/strptime.c:466:4: error: expected expression
FALL_THROUGH;
^
../lib/replace/replace.h:930:24: note: expanded from macro 'FALL_THROUGH'
# define FALL_THROUGH __attribute__ ((fallthrough))
^
../lib/replace/strptime.c:616:4: error: expected expression
FALL_THROUGH;
^
../lib/replace/replace.h:930:24: note: expanded from macro 'FALL_THROUGH'
# define FALL_THROUGH __attribute__ ((fallthrough))
^
2 errors generated.
Waf: Leaving directory `/usr/home/ab/src/samba/bin/default'
Build failed
-> task in 'replace.objlist' failed with exit status 1 (run with -v to display more information)
*** Error code 1
Stop.
make: stopped in /usr/home/ab/src/samba
---------------------------------------------------------
This is an interesting case. Clang has no understanding of a fall
through attribute and it should have been detected by the test we have in
lib/replace/wscript but since it is just a warning for, the test code
was compiled and linked without any issues so we considered the test
actually succeeded and defined HAVE_FALLTHROUGH_ATTRIBUTE.
I fixed this by forcing a warning with a missing declaration into an
error and voila, we have undefined HAVE_FALLTHROUGH_ATTRIBUTE:
--------------------------------------------------------------------
[1/2] Compiling ESC[32mbin/.conf_check_cd4aea0352f3fdcf7437ed2b0237999b/test.cESC[0m
['/usr/bin/clang', '-D_SAMBA_BUILD_=4', '-DHAVE_CONFIG_H=1', '-I/usr/local/include', '-MMD', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '-Werror=missing-declarations', '-I/usr/home/ab/src/samba/lib/replace', '-I.', '-I../..', '-I.', '-I../..', '../../test.c', '-c', '-o/usr/home/ab/src/samba/bin/.conf_check_cd4aea0352f3fdcf7437ed2b0237999b/testbuild/default/test.c.1.o']
err: ../../test.c:237:29: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
FALL_THROUGH;
^
../../test.c:222:42: note: expanded from macro 'FALL_THROUGH'
#define FALL_THROUGH __attribute__((fallthrough))
^
1 error generated.
from /usr/home/ab/src/samba/lib/replace: Test does not build: Traceback (most recent call last):
File "/usr/home/ab/src/samba/third_party/waf/waflib/Configure.py", line 584, in run_build
bld.compile()
File "/usr/home/ab/src/samba/third_party/waf/waflib/Build.py", line 355, in compile
raise Errors.BuildError(self.producer.error)
BuildError: Build failed
-> task in 'testprog' failed with exit status 1 (run with -v to display more information)
from /usr/home/ab/src/samba/lib/replace: The configuration failed
--------------------------------------------------------------------
Attached patches allow me to compile under FreeBSD 11.2 with default
settings as
CFLAGS=-I/usr/local/include ./configure.developer
WAF_MAKE=1 python ./buildtools/bin/waf build --abi-update
(there are various ABI changes in master right now)
I've submitted https://gitlab.com/samba-team/samba/merge_requests/67
with currently developed patches.
--
/ Alexander Bokovoy
More information about the samba-technical
mailing list