[prev in list] [next in list] [prev in thread] [next in thread] 

List:       orocos-dev
Subject:    [Orocos-Dev] [Bug 44] New: fosi.h: _XOPEN_SOURCE 600 is not sufficient to pull in CLONE_* for rtai_l
From:       orocos-bugzilla () fmtc ! be (orocos-bugzilla () fmtc ! be)
Date:       2006-03-10 3:28:47
Message-ID: bug-44-4 () http ! www ! fmtc ! be/orocos-bugzilla/
[Download RAW message or body]

For more information about this bug, visit
     <http://www.fmtc.be/orocos-bugzilla/show_bug.cgi?id=44>

A new bug was added:
           Summary: fosi.h: _XOPEN_SOURCE 600 is not sufficient to pull in
                    CLONE_* for rtai_lxrt.h
           Product: Orocos
           Version: 0.22.0-rc1
          Platform: Intel Compatible
        OS/Version: GNU/Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Operating System Abstraction - Portability
        AssignedTo: orocos-dev@lists.mech.kuleuven.be
        ReportedBy: blg@mast.queensu.ca


The problem:
------------
I found this bug when trying to compile 0.22.0-rc1 on an Linux machine for the
lxrt target. I configured the package with '../configure --with-lxrt
--with-linux=/usr/src/linux --with-lxrt=/usr/rtai'. Then I proceeded to 'make
all' (i.e. no graphical configuration).

When building fosi.c the compiler complains about an included file,
rtai_lxrt.h, having undefined symbols: CLONE_VM,CLONE_PS,and CLONE_FILES.

The reason:
-----------
The symbols in question are defined in bits/sched.h. It is to be included only
by sched.h - fosi.h does this; however, bits/sched.h only defines the values if
__USE_MISC is defined. It is features.h (included by sched.h) that defines
__USE_MISC under various conditions.

It seems to me that the definition in fosi.h, _XOPEN_SOURCE 600, is intended to
enable the definition of __USE_MISC in features.h. But on my system
(glibc-2.3.5) it isn't enough to cause features.h to define __USE_MISC. 

A possible resolution:
----------------------
There are a couple conditions that would:
1. define _BSD_SOURCE
2. define _SVID_SOURCE
3. define _GNU_SOURCE

each has its consequences:
1. (con) if BSD_SOURCE is defined, features.h prefers BSD over POSIX
2. ... (can't think of any)
3. (pro) if _GNU_SOURCE is defined, features.h defines _XOPEN_SOURCE 600

So I chose to replace the _XOPEN_SOURCE definition with _GNU_SOURCE because it
will result in defining the same _XOPEN_SOURCE symbol anyways. The same result
(having __USE_MISC defined) could be had by defining _SVID_SOURCE in addition
to _XOPEN_SOURCE 600.

The patch:
----------
--- packages/os/lxrt/0.22.0-rc1/include/fosi.h~ 2006-03-03 08:50:40.000000000
-0500
+++ packages/os/lxrt/0.22.0-rc1/include/fosi.h  2006-03-09 21:11:19.359294536
-0500
@@ -27,8 +27,8 @@
 #ifndef __FOSI_H
 #define __FOSI_H

-#ifndef _XOPEN_SOURCE
-#define _XOPEN_SOURCE 600   // use all Posix features.
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE   // use all Posix features (and then some).
 #endif

 #define HAVE_FOSI_API


-- 
(this mail is best viewed with a fixed font)
Configure bugmail: http://www.fmtc.be/orocos-bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic