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 '/<<PKGBUILDDIR>>' >>>>> sparse -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -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
Attachment:
signature.asc
Description: OpenPGP digital signature