#874145 vmtouch: FTBFS on non-Linux: many identifiers undeclared

#874145#5
Date:
2017-09-03 15:49:49 UTC
From:
To:
Builds of vmtouch for hurd-i386 and kfreebsd-* (admittedly not release
architectures) have been failing with errors and warnings involving
undeclared identifiers.  The actual errors are

  vmtouch.c:723:14: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'INT8_MAX'?
  vmtouch.c:894:29: error: 'optarg' undeclared (first use in this function); did you mean 'va_arg'?
  vmtouch.c:909:11: error: 'optind' undeclared (first use in this function); did you mean 'optarg'?

but many of the warnings are concerning as well, at least on
kfreebsd-amd64 (where int is narrower than pointers).

For kFreeBSD (__FreeBSD_kernel__), it should suffice to define various
_*_SOURCE macros more broadly.

For the Hurd (__gnu_hurd__), you will also need to account for the
lack of a static PATH_MAX.  Best practice there is to allocate a
dynamic array based on pathconf(_PC_PATH_MAX), or you could simply
supply a fallback definition (typically 4096).

Could you please take a look?

Thanks!

#874145#10
Date:
2017-09-03 20:24:56 UTC
From:
To:
"Aaron M. Ucko" <ucko@debian.org> writes:

Alternatively, building with -std=gnu99 rather than the stricter
-std=c99 should eliminate the need for most or all of these explicit
_*_SOURCE settings.  You'll still need to do something about PATH_MAX on
the Hurd, though.

#874145#15
Date:
2017-09-05 14:38:06 UTC
From:
To:
Hi I'm Doug Hoyte the developer of vmtouch.

Thanks for the report.

I'd rather not specify -std=gnu99 in the default Makefile so as to ensure it's as portable as possible. Do you happen to know what _*_SOURCE defines would work for these platforms?

I'm thinking of including basically the following at the top of vmtouch.c:

#ifdef __gnu_hurd__
#define PATH_MAX 4096
<whatever _*_SOURCE defines are necessary for hurd>
#endif

#ifdef __FreeBSD_kernel__
<whatever _*_SOURCE defines are necessary for kfreebsd>
#endif

Does this make sense?

vmtouch has been tested on ILP32 and LP64 systems. The warnings you are seeing appear to be from string.h not declaring common string routines such as strsep. Hopefully the _*_SOURCE defines you mention will address this.

Thanks,

Doug

#874145#20
Date:
2017-09-05 14:59:08 UTC
From:
To:
Hi,

In https://github.com/hoytech/vmtouch/issues/47#issuecomment-327198799,
the upstream developer says he would welcome shell access on kfreebsd
and hurd porter boxes to check if page eviction is possible on these
platforms. Could you follow-up on that?

Thanks!

Lucas

#874145#27
Date:
2017-09-05 15:21:27 UTC
From:
To:
Lucas Nussbaum <lucas@debian.org> writes:

Hi, Lucas.

Thanks to you and Doug for looking into this report.  I don't have any
personal Hurd or kFreeBSD systems, but am open to sponsoring access to
Debian's project-wide porter boxes once Doug prepares a formal access
request per https://dsa.debian.org/doc/guest-account/.