Bug 7317 - xdm, lbxproxy, and xfs don't build on some GLIBC based systems: _XOPEN_SOURCE undefined
Summary: xdm, lbxproxy, and xfs don't build on some GLIBC based systems: _XOPEN_SOURCE...
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: * Other (show other bugs)
Version: 7.1 (2006.05)
Hardware: x86 (IA32) other
: high major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-24 20:42 UTC by J.P. Larocque
Modified: 2009-09-17 00:37 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description J.P. Larocque 2006-06-24 20:42:01 UTC
The configure scripts for xdm, lbxproxy, and xfs do not define the _XOPEN_SOURCE
macro on Hurd systems, causing these packages to fail to build.  The only time
they do define this macro is on Linux systems.

xdm uses crypt(), so it #includes <unistd.h>.  glibc requires _XOPEN_SOURCE to
be defined when that header file is included, if you wish to use crypt(3):
http://unixhelp.ed.ac.uk/CGI/man-cgi?crypt+3

lbxproxy manipulates the fds_bits member of variables of type fd_set, a
typedefed struct.  This member is normally named __fds_bits on glibc systems,
unless _XOPEN_SOURCE is defined.  This doesn't seem to be documented in
select(3); read the definition for fd_set in /usr/include/sys/select.h on a
glibc machine.

xfs does the same fds_bits manipulation as lbxproxy.

In all three programs, working around the problem by modifying the configure
scripts directly results in correct builds[1] for me.  Here's an example patch
for xdm:

--- configure.orig      2006-05-20 18:45:58.000000000 -0700
+++ configure   2006-06-20 20:00:11.000000000 -0700
@@ -21964,7 +21964,7 @@
 
 
 case $host_os in
-    linux*)
+    linux*|gnu*)
         OS_CFLAGS="-D_XOPEN_SOURCE"
        SU="su"
         ;;

A better solution, apart from of course modifying configure.ac, would be to base
the condition on whether the system uses glibc, rather than what the host kernel is.

I've only compiled the subset of X11R7.1 on The Hurd that I felt I needed to run
the various X clients.  This same problem could also be in the X server, or
elsewhere.

-----

1. Except for xdm, which I'm reporting other bugs on.  I have not yet tested
lbxproxy or xfs in any capacity.
Comment 1 Alan Coopersmith 2006-06-27 09:35:43 UTC
I've put the simple fix shown into xdm CVS head for now until someone figures
out a better solution on testing for the __GLIBC__ define or something similar.

CVSROOT:	/cvs/xorg
Module name:	app
Changes by:	alanc@kemper.freedesktop.org	06/06/27 16:33:26

Log message:
  2006-06-27  Alan Coopersmith  <alan.coopersmith@sun.com>
  
  	* configure.ac:
  	Bugzilla #7317 <https://bugs.freedesktop.org/show_bug.cgi?id=7317>
  	xdm needs to define _XOPEN_SOURCE to build on Hurd (J.P. Larocque)

Modified files:
      app/xdm/:
        ChangeLog configure.ac 
  
  Revision      Changes    Path
  1.55          +6 -0      app/xdm/ChangeLog
  http://webcvs.freedesktop.org/xorg/app/xdm/ChangeLog
  1.43          +2 -2      app/xdm/configure.ac
  http://webcvs.freedesktop.org/xorg/app/xdm/configure.ac
Comment 2 petr.salinger 2006-11-20 07:15:21 UTC
The same holds for GNU/kFreeBSD.

Could you please change detection by

 case $host_os in
-    linux*|gnu*)
+    linux*|gnu*|*-gnu)
         OS_CFLAGS="-D_XOPEN_SOURCE"
        SU="su"
         ;;


Thanks in advance.

Petr
Comment 3 Daniel Stone 2007-02-27 01:32:39 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 4 Alan Coopersmith 2009-09-01 08:12:22 UTC
xfs should also be fixed now, since AC_USE_SYSTEM_EXTENSIONS was added
to it's configure.ac.
Comment 5 Alan Coopersmith 2009-09-17 00:37:22 UTC
(In reply to comment #4)
> xfs should also be fixed now, since AC_USE_SYSTEM_EXTENSIONS was added
> to it's configure.ac.

xdm has been switched to AC_USE_SYSTEM_EXTENSIONS too, and lbxproxy is
no longer actively maintained, so closing as fixed.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.