delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/09/13/10:55:32

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=lsgEQgGS6m5Ya7rp
DgP2xNUg6nELTX/X0a74qUV/KCo6gZzDZ/wnuo5pAErm2aMTbvU1D1MLOYKl5GM7
wsbRbhDOkl0kQMmdoaBPIMcy6NsOY4Kn1igtWuq2anSfZ01g+CA1HN2k329xUQ9g
cZyfJBogfzyZci0muBLpRXe8Fyc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=EQb0nTVomE1OFW2zwGIIW8
igjPU=; b=MeM/5lpXcyt4NwCOlySzjnuBchPA+8dTRS4irzuAi1aocFoGABjps5
BTmg7SO8u53rBZRZxzy2qQEJzpdjcry6bqdcD9IGGw19b+oxtnbq0RGh/tbMnVez
BxKTGJJ2MbA4zCBGvsK6coJHMLU8stgz8HHH6MNoCibSIRIRZmgcM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-5.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Envelope-From:sk:michael, H*r:4.77, main=e2, HContent-Transfer-Encoding:8bit?=
X-HELO: atfriesa01.ssi-schaefer.com
Subject: Re: [ANNOUNCEMENT] cygwin 3.1.0-0.4 (TEST)
To: cygwin AT cygwin DOT com
References: <announce DOT 20190905090845 DOT 2201-1-kbrown AT cornell DOT edu>
From: Michael Haubenwallner <michael DOT haubenwallner AT ssi-schaefer DOT com>
Openpgp: preference=signencrypt
Message-ID: <855a9543-6908-42f0-576a-0f161777f715@ssi-schaefer.com>
Date: Fri, 13 Sep 2019 16:54:32 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <announce.20190905090845.2201-1-kbrown@cornell.edu>

On 9/5/19 3:16 PM, Ken Brown wrote:
> The following packages have been uploaded to the Cygwin distribution
> as test releases:
> 
> * cygwin-3.1.0-0.4
> * cygwin-devel-3.1.0-0.4
> * cygwin-doc-3.1.0-0.4

> - New APIs: sched_getaffinity, sched_setaffinity, pthread_getaffinity_np,
>   pthread_setaffinity_np, plus CPU_SET macros.

There's some problem with <sched.h>, seen with boost-1.71.0/bootstrap.sh,
even after tweaking their sysinfo.cpp like this to include <sched.h>:

-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_CYGWIN)

This boils down to a test case like this that succeeds to *compile* on Linux,
although requires _GNU_SOURCE to be defined earlier to perform anything useful:

$ cat > test.cc <<'EOF'
#ifdef LIKE_BOOST
# include <pthread.h>
# define _GNU_SOURCE
#endif
#include <sched.h>
int main()
{
#if defined(CPU_COUNT_S)
  ::cpu_set_t cpu_set;
  if (::sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set) == 0)
    {
      return CPU_COUNT_S(sizeof(cpu_set_t), &cpu_set);
    }
#endif
  return 0;
}
EOF

Both these commands fail to compile on Cygwin with identical error:
$ g++ test.c -DLIKE_BOOST
$ g++ test.c
test.c: In function ‘main’:
test.c:10:7: warning: implicit declaration of function ‘sched_getaffinity’; did you mean ‘sched_getparam’? [-Wimplicit-function-declaration]
   if (sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set) == 0)
       ^~~~~~~~~~~~~~~~~
       sched_getparam

Actually it is boost's fault to include <pthread.h> before defining _GNU_SOURCE,
but it feels like Cygwin should *not* define CPU_COUNT_S without _GNU_SOURCE.

Thoughts?
/haubi/

PS: This does work as expected:
$ g++ test.c -D_GNU_SOURCE

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019