This is an archive of the discontinued Mercurial Phabricator instance.

chg: define _GNU_SOURCE to allow CentOS 5 compilation
ClosedPublic

Authored by Mathiasdm on Aug 7 2017, 8:19 AM.

Details

Summary

Without this flag, compilation fails with:
hgclient.c: In function 'hgc_open':
hgclient.c:466: error: 'O_DIRECTORY' undeclared (first use in this function)
hgclient.c:466: error: (Each undeclared identifier is reported only once
hgclient.c:466: error: for each function it appears in.)

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Mathiasdm created this revision.Aug 7 2017, 8:19 AM
Mathiasdm abandoned this revision.Aug 7 2017, 8:22 AM

My mistake, I meant to send 2 changesets and forgot to modify the revset.

Mathiasdm reclaimed this revision.Aug 7 2017, 8:23 AM

Alright, it appears this does not work like I expected...

quark added a subscriber: quark.Aug 7 2017, 12:13 PM

Could you include the compiler error if _GNU_SOURCE is not set in commit message?

Mathiasdm edited the summary of this revision. (Show Details)Aug 8 2017, 2:25 AM
yuja accepted this revision as: yuja.Aug 8 2017, 8:24 AM
yuja added a subscriber: yuja.

Looks good. The manpage says

The O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags are not specified in POSIX.1-2001, but are specified in
POSIX.1-2008. Since glibc 2.12, one can obtain their definitions by defining either _POSIX_C_SOURCE with
a value greater than or equal to 200809L or _XOPEN_SOURCE with a value greater than or equal to 700. In
glibc 2.11 and earlier, one obtains the definitions by defining _GNU_SOURCE.

and the compiler error appears to be included in the commit message.

yuja added a comment.Aug 8 2017, 8:38 AM

I've queued these for stable so 4.3 rpm can be built for CentOS 5.

This revision was automatically updated to reflect the committed changes.