You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by barries <ba...@slaysys.com> on 2001/05/31 18:44:00 UTC

Build failure due to pthread_rwlock_t

This bit added recently to srclib/apr/include/arch/unix/locks.h:154

   #ifdef HAVE_PTHREAD_RWLOCK_INIT
       pthread_rwlock_t rwlock;
   #endif

blows up compiling on RH6.2 linux with stock build environment
(egcs-2.91.66, glib-devel v2.1.3, let me know if you need more info).

pthread_rwlock_t is only declared/defined if -D_XOPEN_SOURCE=500 (or
-D_GNU_SOURCE) but that causes other glitches.

- Barrie

Re: Build failure due to pthread_rwlock_t

Posted by "Victor J. Orlikowski" <v....@gte.net>.
 > So, the only thing we need to look out for breaking anything is
 > _XOPEN_SOURCE=500, which simply enforces Single Unix conformance.
 > Therefore, I think it's probably safe to put these flags into
 > apr_hints.m4.
 > The question is, does this apply only to versions of Linux greater
 > than (or equal to) 2.0?

Yuck. I have to follow myself up.
I'm putting this in, for Linux 2.0 and later.
In Linux 2.0, the clone() syscall was created, which is used to do
threading. If rwlocks are present, then they will work with 2.0 and
later.

Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
orlikowski@apache.org
vjo@us.ibm.com


Re: Build failure due to pthread_rwlock_t

Posted by "Victor J. Orlikowski" <v....@gte.net>.
 > So, the only thing we need to look out for breaking anything is
 > _XOPEN_SOURCE=500, which simply enforces Single Unix conformance.
 > Therefore, I think it's probably safe to put these flags into
 > apr_hints.m4.
 > The question is, does this apply only to versions of Linux greater
 > than (or equal to) 2.0?

Yuck. I have to follow myself up.
I'm putting this in, for Linux 2.0 and later.
In Linux 2.0, the clone() syscall was created, which is used to do
threading. If rwlocks are present, then they will work with 2.0 and
later.

Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
orlikowski@apache.org
vjo@us.ibm.com


Re: Build failure due to pthread_rwlock_t

Posted by "Victor J. Orlikowski" <v....@gte.net>.
 > What is the proper solution here?  Should we *always* add the 
 > -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE to the hints for
 > Linux-based platforms?
 > 
 > Or, would adding these to apr_hints.m4 break other things?  I can
 > try and get access to a Linux box tonight and play with it some.

If we desire rwlocks, answer is yes.
Checking /usr/include/features.h on my Linux box:

/* If nothing (other than _GNU_SOURCE) is defined,
   define _BSD_SOURCE and _SVID_SOURCE.  */
#if (!defined __STRICT_ANSI__ && !defined _ISOC9X_SOURCE && \
     !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
     !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
     !defined _BSD_SOURCE && !defined _SVID_SOURCE)
# define _BSD_SOURCE    1
# define _SVID_SOURCE   1
#endif

Hence, _BSD_SOURCE and _SVID_SOURCE are defined by default.
We probably don't want the GNU extensions, so we must define these, as
well as _XOPEN_SOURCE.
So, the only thing we need to look out for breaking anything is
_XOPEN_SOURCE=500, which simply enforces Single Unix conformance.
Therefore, I think it's probably safe to put these flags into
apr_hints.m4.
The question is, does this apply only to versions of Linux greater
than (or equal to) 2.0?

Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
orlikowski@apache.org
vjo@us.ibm.com


Re: Build failure due to pthread_rwlock_t

Posted by "Victor J. Orlikowski" <v....@gte.net>.
 > What is the proper solution here?  Should we *always* add the 
 > -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE to the hints for
 > Linux-based platforms?
 > 
 > Or, would adding these to apr_hints.m4 break other things?  I can
 > try and get access to a Linux box tonight and play with it some.

If we desire rwlocks, answer is yes.
Checking /usr/include/features.h on my Linux box:

/* If nothing (other than _GNU_SOURCE) is defined,
   define _BSD_SOURCE and _SVID_SOURCE.  */
#if (!defined __STRICT_ANSI__ && !defined _ISOC9X_SOURCE && \
     !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
     !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
     !defined _BSD_SOURCE && !defined _SVID_SOURCE)
# define _BSD_SOURCE    1
# define _SVID_SOURCE   1
#endif

Hence, _BSD_SOURCE and _SVID_SOURCE are defined by default.
We probably don't want the GNU extensions, so we must define these, as
well as _XOPEN_SOURCE.
So, the only thing we need to look out for breaking anything is
_XOPEN_SOURCE=500, which simply enforces Single Unix conformance.
Therefore, I think it's probably safe to put these flags into
apr_hints.m4.
The question is, does this apply only to versions of Linux greater
than (or equal to) 2.0?

Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
orlikowski@apache.org
vjo@us.ibm.com


Re: Build failure due to pthread_rwlock_t

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Thu, May 31, 2001 at 03:10:43PM -0400, Victor J. Orlikowski wrote:
>  > pthread_rwlock_t is only declared/defined if -D_XOPEN_SOURCE=500 (or
>  > -D_GNU_SOURCE) but that causes other glitches.
> 
> The pthread_rwlock_t code works, and everythings builds, as long as
> my CFLAGS are the following on RH 6.2
> 
> -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE

(This is what I get for not verifying on Linux...)

What is the proper solution here?  Should we *always* add the 
-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE to the hints for
Linux-based platforms?

Or, would adding these to apr_hints.m4 break other things?  I can
try and get access to a Linux box tonight and play with it some.
-- justin


Re: Build failure due to pthread_rwlock_t

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Thu, May 31, 2001 at 03:10:43PM -0400, Victor J. Orlikowski wrote:
>  > pthread_rwlock_t is only declared/defined if -D_XOPEN_SOURCE=500 (or
>  > -D_GNU_SOURCE) but that causes other glitches.
> 
> The pthread_rwlock_t code works, and everythings builds, as long as
> my CFLAGS are the following on RH 6.2
> 
> -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE

(This is what I get for not verifying on Linux...)

What is the proper solution here?  Should we *always* add the 
-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE to the hints for
Linux-based platforms?

Or, would adding these to apr_hints.m4 break other things?  I can
try and get access to a Linux box tonight and play with it some.
-- justin


Re: Build failure due to pthread_rwlock_t

Posted by "Victor J. Orlikowski" <v....@gte.net>.
 > pthread_rwlock_t is only declared/defined if -D_XOPEN_SOURCE=500 (or
 > -D_GNU_SOURCE) but that causes other glitches.

The pthread_rwlock_t code works, and everythings builds, as long as
my CFLAGS are the following on RH 6.2

-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE

HTH,
Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
orlikowski@apache.org
vjo@us.ibm.com