Bug 1067110 - /usr/include/features.h:145:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp
Summary: /usr/include/features.h:145:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: golang
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Adam Goode
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1074180 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-19 17:38 UTC by Adam Miller
Modified: 2014-06-09 13:32 UTC (History)
18 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-02-20 20:37:53 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Plan 9 from User Space include/u.h - shipped as part of golang (5.59 KB, text/x-chdr)
2014-02-20 16:36 UTC, Adam Miller
no flags Details

Description Adam Miller 2014-02-19 17:38:35 UTC
current version of golang fails to build against latest rawhide glibc and gcc is throwing:

http://koji.fedoraproject.org/koji/taskinfo?taskID=6548071
---
http://kojipkgs.fedoraproject.org//work/tasks/8091/6548091/build.log
---
gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wuninitialized -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -O2 -c -m32 -DPLAN9PORT -I /builddir/build/BUILD/go/include -I /builddir/build/BUILD/go/src/lib9 -o $WORK/_exits.o /builddir/build/BUILD/go/src/lib9/_exits.c
gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wuninitialized -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -O2 -c -m32 -DPLAN9PORT -I /builddir/build/BUILD/go/include -I /builddir/build/BUILD/go/src/lib9 -o $WORK/_p9dir.o /builddir/build/BUILD/go/src/lib9/_p9dir.c
gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wuninitialized -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -O2 -c -m32 -DPLAN9PORT -I /builddir/build/BUILD/go/include -I /builddir/build/BUILD/go/src/lib9 -o $WORK/atoi.o /builddir/build/BUILD/go/src/lib9/atoi.c
gcc -Wall -Wstrict-prototypes -Wextra -Wunused -Wuninitialized -Wno-sign-compare -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment -Wno-missing-field-initializers -Werror -fno-common -ggdb -pipe -O2 -c -m32 -DPLAN9PORT -I /builddir/build/BUILD/go/include -I /builddir/build/BUILD/go/src/lib9 -o $WORK/await.o /builddir/build/BUILD/go/src/lib9/await.c
In file included from /usr/include/inttypes.h:25:0,
                 from /builddir/build/BUILD/go/include/u.h:59,
                 from /builddir/build/BUILD/go/src/lib9/_exits.c:26:
/usr/include/features.h:145:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
In file included from /usr/include/inttypes.h:25:0,
                 from /builddir/build/BUILD/go/include/u.h:59,
                 from /builddir/build/BUILD/go/src/lib9/await.c:30:
/usr/include/features.h:145:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
In file included from /usr/include/inttypes.h:25:0,
                 from /builddir/build/BUILD/go/include/u.h:59,
                 from /builddir/build/BUILD/go/src/lib9/atoi.c:26:
/usr/include/features.h:145:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
In file included from /usr/include/inttypes.h:25:0,
                 from /builddir/build/BUILD/go/include/u.h:59,
                 from /builddir/build/BUILD/go/src/lib9/_p9dir.c:26:
/usr/include/features.h:145:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Werror=cpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^

Comment 1 Adam Miller 2014-02-19 17:40:23 UTC
Version in question: glibc-2.19.90-1.fc21

Comment 2 Carlos O'Donell 2014-02-20 16:07:55 UTC
This is expected. The warning is correct. The _BSD_SOURCE and _SVID_SOURCE feature test macros are deprecated as of glibc 2.19.90 (2.20 devel).

What defines _BSD_SOURCE or _SVID_SOURCE for you?

Comment 3 Adam Miller 2014-02-20 16:36:48 UTC
Created attachment 865604 [details]
Plan 9 from User Space include/u.h - shipped as part of golang

Comment 4 Adam Miller 2014-02-20 16:37:37 UTC
u.h that's part of the golang source distribution (attached)

Comment 5 Carlos O'Donell 2014-02-20 17:13:19 UTC
You have several options.

The first question is: Do you really need those feature macros defined?

I would start by removing them and building.

Those definitions may just have been copied blindly from other source configurations without thinking about the interfaces they enable.

If you do need the interfaces enabled by _BSD_SOURCE and or _SVID_SOURCE, then you can do the following:

#if defined __linux__ || defined __GNU__ || defined __GLIBC__
#define _DEFAULT_SOURCE 1
#else
#define _BSD_SOURCE 1
#define _SVID_SOURCE 1
#endif

So you have two options to try.

Build without those macros and see if it works, this tests to see if you actually ever needed them.

Modify the headers to define _DEFAULT_SOURCE instead which is the new all-encompassing feature test macro.

Notice that the old feature test macros are not deprecated yet, but we are issuing a warning. In your case with -Werror the warning is treated as if it were an error.

Comment 6 Adam Miller 2014-02-20 20:37:53 UTC
It appears that the macro is needed, I've patched using what you provided and it worked. I'll close this as NOTABUG, thank you for your help and apologies for the line noise.

Comment 7 Carlos O'Donell 2014-02-20 20:45:03 UTC
(In reply to Adam Miller from comment #6)
> It appears that the macro is needed, I've patched using what you provided
> and it worked. I'll close this as NOTABUG, thank you for your help and
> apologies for the line noise.

No need to apologize, I'm a glibc expert and I'm here to help. It was perfectly valid to reach out for assistance on this issue. I'm glad things are working again.

Comment 8 Frank Ch. Eigler 2014-02-24 15:37:06 UTC
Carlos, what is the official rune to make -Werror code build with both old
and new glibc, which had some reason for _BSD_SOURCE?

NOTABUG seems like an unfortunate way of brushing off build breakage due
to this glibc change.

Comment 9 Petr Spacek 2014-02-25 08:49:19 UTC
(In reply to Frank Ch. Eigler from comment #8)
> Carlos, what is the official rune to make -Werror code build with both old
> and new glibc, which had some reason for _BSD_SOURCE?
> 
> NOTABUG seems like an unfortunate way of brushing off build breakage due
> to this glibc change.

I'm facing the same problem with my package. Carlos, please shed light on this.

Comment 10 Carlos O'Donell 2014-02-25 16:15:51 UTC
(In reply to Petr Spacek from comment #9)
> (In reply to Frank Ch. Eigler from comment #8)
> > Carlos, what is the official rune to make -Werror code build with both old
> > and new glibc, which had some reason for _BSD_SOURCE?
> > 
> > NOTABUG seems like an unfortunate way of brushing off build breakage due
> > to this glibc change.
> 
> I'm facing the same problem with my package. Carlos, please shed light on
> this.

The way this is going to work is like this:

https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

This isn't the way it works yet in Fedora Rawhide, but it will in about 24 hours.

See: https://sourceware.org/bugzilla/show_bug.cgi?id=16632

Comment 11 Hans de Goede 2014-03-25 14:18:22 UTC
*** Bug 1074180 has been marked as a duplicate of this bug. ***

Comment 12 Jens Petersen 2014-06-06 04:14:07 UTC
This also affects ghc on some secondary archs BTW:
I will try patching to _DEFAULT_SOURCE.

Comment 13 Jens Petersen 2014-06-06 06:30:30 UTC
https://github.com/ghc/ghc/blob/master/includes/Stg.h#L49 currently has:

:
#ifndef IN_STG_CODE
# define IN_STG_CODE 1

// Turn on C99 for .hc code.  This gives us the INFINITY and NAN
// constants from math.h, which we occasionally need to use in .hc (#1861)
# define _ISOC99_SOURCE

// We need _BSD_SOURCE so that math.h defines things like gamma
// on Linux
# define _BSD_SOURCE
#endif
:

Any suggestions for now to update that to prefer _DEFAULT_SOURCE
upstream in a portable manner?

Comment 14 Frank Ch. Eigler 2014-06-06 14:02:20 UTC
Jens, you could just add

   #define _DEFAULT_SOURCE

to what's already there.


Note You need to log in before you can comment on or make changes to this bug.