[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] ✘gpsd build broken with glibc 2.23
From: |
Fred Wright |
Subject: |
Re: [gpsd-dev] ✘gpsd build broken with glibc 2.23 |
Date: |
Fri, 15 Apr 2016 20:14:37 -0700 (PDT) |
On Fri, 15 Apr 2016, Gary E. Miller wrote:
> On Fri, 15 Apr 2016 16:12:58 -0700 (PDT)
> Fred Wright <address@hidden> wrote:
> > It appears that features.h (included by sys/types.h) defines
> > __USE_BSD if _BSD_SOURCE is defined, and that that in turn causes
> > sysmacros.h to be included by sys/types.h. But one has to be careful
> > to define any feature test options before *any* includes, not just
> > the one(s) of interest.
>
>
> In theory, but fails in practice:
>
>
> -#include <sys/types.h>
> +#define _BSD_SOURCE 1
> +#include <sys/types.h> /* defines major() */
> #include <sys/stat.h>
> #include <sys/ioctl.h>
> #include <stdio.h>
>
> from serial.c:7:
> /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and
> _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
> # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
>
> serial.c: In function 'gpsd_classify':
> serial.c:69:17: warning: implicit declaration of function 'major'
> [-Wimplicit-function-declaration]
> int devmajor = major(sb.st_rdev);
> ^
>
> Looks like _BSD_SOURCE is gone after glibc 2.19.
>
> It got replaced by _DEFAULT_SOURCE, but that also fails the same way:
>
> -#include <sys/types.h>
> +#define _DEFAULT_SOURCE 1
> +#include <sys/types.h> /* defines major() */
> #include <sys/stat.h>
> #include <sys/ioctl.h>
> #include <stdio.h>
>
> At least my patch actually worked. :-)
With a name like "_DEFAULT_SOURCE", maybe the value matters. Did you look
at how it's used?
Though "deprecated" isn't supposed to mean "not working at all", anyway.
:-)
Fred Wright