Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')

2018-09-25 Thread Luc Van Oostenryck
On Tue, Sep 25, 2018 at 04:38:01PM +0200, Uwe Kleine-König wrote:
> > By *default*, if no -gcc-base-dir is used, sparse use the same dir
> > as the one used by the GCC used to compile sparse itself. It's only
> > this default that is hardcoded.
> 
> I wasn't sure if this is expected to work. I had in mind, that the
> version of gcc is used somewhere but couldn't find proof for that.

Several other flags have their default value corresponding to the
GCC used to compile sparse: for example the architecture (x86, x86-64)
or the endianness. The one you're thinking about is probably the macros
for the GCC version: __GNUC__, __GNUC_MINOR__ & __GNUC_PATCHLEVEL__.

As far as I know, everything that should matter can be set explicitly
either by defining the macro via -D...=... or an explicit flag like
-m{32,64}, -m{little,big}-endian, -funsigned-char, ...

When using sparse for userspace code, it may be best to use the cgcc
wrapper since it take care to set (some of) these values. I'm saying
'may' because personnaly, I have no experience of using sparse via
cgcc (as an user, I've only used sparse for OS or bare-metal code)
but I know others use it like so (for example for git).

> > In case the default can't be used, like here, I think the best is
> > to add in your Makefile something like:
> > GCC_BASE_DIR=$(shell $(CC) -print-file-name=)
> > SPARSE_FLAGS= -gcc-base-dir $(GCC_BASE_DIR)
> > ...
> > sparse $(SPARSE_FLAGS) ...
> 
> IMHO it is sensible to let sparse depend on (or at least recommend) gcc.
> And then the default value should be right.
> 
> > This doesn't need to be done at each invocation of sparse (but will be done
> > at each top-level make invocation).
> 
> I'd say you'd need := for this effect instead of =.

Yes, indeed.

> Best regards and thanks for your valuable input,
> Uwe

You're very welcome,
-- Luc



Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')

2018-09-25 Thread Uwe Kleine-König
Hello Luc,

On 09/24/2018 06:23 PM, Luc Van Oostenryck wrote:
> On Fri, Sep 14, 2018 at 09:45:44PM +0200, Uwe Kleine-König wrote:
 Santiago Vila wrote...

>   make -j1 check
> make[1]: Entering directory '/<>'
> sparse -g -O2 -fdebug-prefix-map=/<>=. 
> -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 
> -Wall -Wextra -g -I. -DDO_DEBUG -I/usr/include/libnl3 *.[ch]
> /usr/include/err.h:25:11: error: unable to open 'stdarg.h'

 To reproduce this it's important to remove gcc-7 from the build chroot
 (apt purge libgcc-7-dev ; apt --purge autoremove).

 Problem is, sparse appearently uses hardcoded paths and looks for
 stdarg.h in (among other places)
> 
> Well, sparse needs to know where it can find the system header files.
> There is an option for this: -gcc-base-dir (and -multiarch-dir).
> Usually you will want to use either some that are installed by your
> distro or the one that match the exact GCC version you're using.

I think I don't want to impose on sparse users to know the system header
location.

> By *default*, if no -gcc-base-dir is used, sparse use the same dir
> as the one used by the GCC used to compile sparse itself. It's only
> this default that is hardcoded.

I wasn't sure if this is expected to work. I had in mind, that the
version of gcc is used somewhere but couldn't find proof for that.

> In case the default can't be used, like here, I think the best is
> to add in your Makefile something like:
>   GCC_BASE_DIR=$(shell $(CC) -print-file-name=)
>   SPARSE_FLAGS= -gcc-base-dir $(GCC_BASE_DIR)
>   ...
>   sparse $(SPARSE_FLAGS) ...

IMHO it is sensible to let sparse depend on (or at least recommend) gcc.
And then the default value should be right.

> This doesn't need to be done at each invocation of sparse (but will be done
> at each top-level make invocation).

I'd say you'd need := for this effect instead of =. But as I intend to
make sure that with sparse the default headers are also available, this
is a non-issue. (And this only happened because sparse was built with
gcc-7 while horst was built with gcc-8.)

Best regards and thanks for your valuable input,
Uwe



signature.asc
Description: OpenPGP digital signature


Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')

2018-09-24 Thread Luc Van Oostenryck
On Fri, Sep 14, 2018 at 09:45:44PM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> [Cc += sparse mailing list]

Sorry for the late answer.
 
> > > Santiago Vila wrote...
> > > 
> > > > make -j1 check
> > > > make[1]: Entering directory '/<>'
> > > > sparse -g -O2 -fdebug-prefix-map=/<>=. 
> > > > -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 
> > > > -Wall -Wextra -g -I. -DDO_DEBUG -I/usr/include/libnl3 *.[ch]
> > > > /usr/include/err.h:25:11: error: unable to open 'stdarg.h'
> > > 
> > > To reproduce this it's important to remove gcc-7 from the build chroot
> > > (apt purge libgcc-7-dev ; apt --purge autoremove).
> > > 
> > > Problem is, sparse appearently uses hardcoded paths and looks for
> > > stdarg.h in (among other places)

Well, sparse needs to know where it can find the system header files.
There is an option for this: -gcc-base-dir (and -multiarch-dir).
Usually you will want to use either some that are installed by your
distro or the one that match the exact GCC version you're using.

By *default*, if no -gcc-base-dir is used, sparse use the same dir
as the one used by the GCC used to compile sparse itself. It's only
this default that is hardcoded.

> > > Solution is to rebuild sparse, building horst was successful then.
> > > If this is true (please check!), the interesting question is why this
> > > wasn't a problem in earlier gcc version bumps.
> 
> I think this is a known limitation of sparse and there are three
> ways to fix this (in my order of preference):
> 
>  a) let horst use cgcc -no-compile instead of sparse; or
>  b) let sparse depend on libgcc-7-dev (or whatever provides the
> necessary files); or
>  c) use autodetection which gcc is used and pick its files.
>
> I'm not sure if a) fixes the problem. It fixed another problem we had
> with horst's usage of sparse in the past though[1].
> 
> The downside of c) is that running this autodetection on every call to
> sparse is probably slowing down sparse a bit which isn't nice.

In case the default can't be used, like here, I think the best is
to add in your Makefile something like:
GCC_BASE_DIR=$(shell $(CC) -print-file-name=)
SPARSE_FLAGS= -gcc-base-dir $(GCC_BASE_DIR)
...
sparse $(SPARSE_FLAGS) ...

This doesn't need to be done at each invocation of sparse (but will be done
at each top-level make invocation).

Regards,
-- Luc



Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')

2018-09-14 Thread Uwe Kleine-König
Hello,

[Cc += sparse mailing list]

On Fri, Sep 14, 2018 at 05:04:09PM +0300, Adrian Bunk wrote:
> Control: reassign -1 sparse 0.5.2-1
> Control: affects -1 src:horst
> 
> On Sat, Aug 25, 2018 at 10:09:47PM +0200, Christoph Biedl wrote:
> > Santiago Vila wrote...
> > 
> > >   make -j1 check
> > > make[1]: Entering directory '/<>'
> > > sparse -g -O2 -fdebug-prefix-map=/<>=. 
> > > -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 
> > > -Wall -Wextra -g -I. -DDO_DEBUG -I/usr/include/libnl3 *.[ch]
> > > /usr/include/err.h:25:11: error: unable to open 'stdarg.h'
> > 
> > To reproduce this it's important to remove gcc-7 from the build chroot
> > (apt purge libgcc-7-dev ; apt --purge autoremove).
> > 
> > Problem is, sparse appearently uses hardcoded paths and looks for
> > stdarg.h in (among other places)
> > 
> > | /usr/lib/gcc/x86_64-linux-gnu/7//include/stdarg.h
> > |   ^
> > 
> > ... which fails.
> > 
> > Solution is to rebuild sparse, building horst was successful then.
> > If this is true (please check!), the interesting question is why this
> > wasn't a problem in earlier gcc version bumps.

I think this is a known limitation of sparse and there are three
ways to fix this (in my order of preference):

 a) let horst use cgcc -no-compile instead of sparse; or
 b) let sparse depend on libgcc-7-dev (or whatever provides the
necessary files); or
 c) use autodetection which gcc is used and pick its files.

I'm not sure if a) fixes the problem. It fixed another problem we had
with horst's usage of sparse in the past though[1].

The downside of c) is that running this autodetection on every call to
sparse is probably slowing down sparse a bit which isn't nice.

Best regards
Uwe

[1] https://bugs.debian.org/873508


signature.asc
Description: PGP signature


Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')

2018-09-14 Thread Adrian Bunk
Control: reassign -1 sparse 0.5.2-1
Control: affects -1 src:horst

On Sat, Aug 25, 2018 at 10:09:47PM +0200, Christoph Biedl wrote:
> Santiago Vila wrote...
> 
> > make -j1 check
> > make[1]: Entering directory '/<>'
> > sparse -g -O2 -fdebug-prefix-map=/<>=. 
> > -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -Wall 
> > -Wextra -g -I. -DDO_DEBUG -I/usr/include/libnl3 *.[ch]
> > /usr/include/err.h:25:11: error: unable to open 'stdarg.h'
> 
> To reproduce this it's important to remove gcc-7 from the build chroot
> (apt purge libgcc-7-dev ; apt --purge autoremove).
> 
> Problem is, sparse appearently uses hardcoded paths and looks for
> stdarg.h in (among other places)
> 
> | /usr/lib/gcc/x86_64-linux-gnu/7//include/stdarg.h
> |   ^
> 
> ... which fails.
> 
> Solution is to rebuild sparse, building horst was successful then.
> If this is true (please check!), the interesting question is why this
> wasn't a problem in earlier gcc version bumps.

Thanks for the analysis, reassigning to sparse.

> Christoph

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed



Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')

2018-08-25 Thread Christoph Biedl
Santiago Vila wrote...

>   make -j1 check
> make[1]: Entering directory '/<>'
> sparse -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
> -Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
> -I/usr/include/libnl3 *.[ch]
> /usr/include/err.h:25:11: error: unable to open 'stdarg.h'

To reproduce this it's important to remove gcc-7 from the build chroot
(apt purge libgcc-7-dev ; apt --purge autoremove).

Problem is, sparse appearently uses hardcoded paths and looks for
stdarg.h in (among other places)

| /usr/lib/gcc/x86_64-linux-gnu/7//include/stdarg.h
|   ^

... which fails.

Solution is to rebuild sparse, building horst was successful then.
If this is true (please check!), the interesting question is why this
wasn't a problem in earlier gcc version bumps.

Christoph


signature.asc
Description: PGP signature


Bug#906472: horst: FTBFS in buster/sid (unable to open 'stdarg.h')

2018-08-17 Thread Santiago Vila
Package: src:horst
Version: 5.0-2
Severity: serious
Tags: ftbfs

Dear maintainer:

I tried to build this package in buster but it failed:


[...]
 debian/rules build-arch
dh build-arch 
   dh_update_autotools_config -a
   dh_autoreconf -a
   dh_auto_configure -a
   dh_auto_build -a
make -j1
make[1]: Entering directory '/<>'
gcc -MM -I. average.c capture.c channel.c conf_options.c control.c 
display-channel.c display-essid.c display-filter.c display-help.c 
display-history.c display-main.c display-spectrum.c display-statistics.c 
display.c essid.c ieee80211_util.c ifctrl-ioctl.c listsort.c main.c network.c 
node.c protocol_parser.c wlan_parser.c radiotap/radiotap.c util.c wlan_util.c 
ifctrl-nl80211.c >.objdeps.mk
echo '-g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3' | cmp -s - .buildflags || echo '-g -O2 
-fdebug-prefix-map=/<>=. -fstack-protector-strong -Wformat 
-Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3' > .buildflags
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o average.o average.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o capture.o capture.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o channel.o channel.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o conf_options.o 
conf_options.c

[... snipped ...]

cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o display-essid.o 
display-essid.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o display-filter.o 
display-filter.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o display-help.o 
display-help.c
display-help.c: In function 'update_help_win':
display-help.c:39:66: warning: macro "__DATE__" might prevent reproducible 
builds [-Wdate-time]
  print_centered(win, 5, COLS, "Version " VERSION " (build date " __DATE__ " " 
__TIME__ ")");
  ^~~~
display-help.c:39:79: warning: macro "__TIME__" might prevent reproducible 
builds [-Wdate-time]
  print_centered(win, 5, COLS, "Version " VERSION " (build date " __DATE__ " " 
__TIME__ ")");
   
^~~~
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o display-history.o 
display-history.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o display-main.o 
display-main.c
display-main.c: In function 'sort_input':
display-main.c:129:11: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
   do_sort = c;
   ^~~
display-main.c:131:2: note: here
  case '\r': case KEY_ENTER:
  ^~~~
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o display-spectrum.o 
display-spectrum.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o 
display-statistics.o display-statistics.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o display.o display.c
cc -g -O2 -fdebug-prefix-map=/<>=. -fstack-protector-strong 
-Wformat -Werror=format-security -std=gnu99 -Wall -Wextra -g -I. -DDO_DEBUG 
-I/usr/include/libnl3 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o essid.o essid.c
cc -g