After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 672406 - glib/tests/include.c fails to build on FreeBSD
glib/tests/include.c fails to build on FreeBSD
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: build
unspecified
Other FreeBSD
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-03-19 17:04 UTC by Raphael Kubo da Costa
Modified: 2012-03-22 15:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix. (996 bytes, patch)
2012-03-19 17:22 UTC, Raphael Kubo da Costa
committed Details | Review

Description Raphael Kubo da Costa 2012-03-19 17:04:18 UTC
glib/tests/include.c #defines _POSIX_C_SOURCE to 0 before #including <pthread.h>, which causes compilation problems on FreeBSD (and perhaps other platforms as well).

FreeBSD's pthread.h gets its clockid_t typedef from time.h, which is included per the standard. However, the typedef is created only if _POSIX_C_SOURCE has a valid value (ie. it's bigger than 199309L). At first I thought this was a problem on the FreeBSD side, but per [1] it looks like the problem should be fixed on the glib side.

Simply removing the line defining _POSIX_C_SOURCE to 0 should be enough to fix the problem and make the test still test for bug 659866.

[1] http://lists.freebsd.org/pipermail/freebsd-threads/2012-March/005251.html
Comment 1 Raphael Kubo da Costa 2012-03-19 17:16:36 UTC
(In reply to comment #0)
> Simply removing the line defining _POSIX_C_SOURCE to 0 should be enough to fix
> the problem and make the test still test for bug 659866.

Sorry about this part; removing that define will make glibc set _POSIX_C_SOURCE to 200809L, which is not what we want. Setting it to 199309 should make it work as expected on both glibc (doesn't turn __USE_UNIX98 or __USE_XOPEN2K on) and FreeBSD's libc (creates the clockid_t typedef, __USE_UNIX98 and __USE_XOPEN2K are never defined or used anywhere).
Comment 2 Raphael Kubo da Costa 2012-03-19 17:22:01 UTC
Created attachment 210102 [details] [review]
Proposed fix.

Proposed patch for master (dunno if it needs to be applied to other branches too).
Comment 3 Colin Walters 2012-03-22 15:02:26 UTC
Review of attachment 210102 [details] [review]:

Testing include semantics is kind of painful...but let's keep it working.  Patch looks OK to me.