delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/09/13/18:09:17

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=difi7FOMgPa/EFm6
Trs1ozw0s/62zAFMIHXOzff3Ra2Fu4ovs/+qtGCVjpFw4a35pLaOCfv42ERVOHlB
Mqki6vsVU75JoKBb81+gG8OlPFCK6/k1bumKmg0gASFIxgvizmCKWSx+Du/zqnJI
NdErNvWSCw8k3jXIXYElNEu9OxE=
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=m1JBfmgUB4s7CyCvgAklVL
iaEQI=; b=sl/w2zZlqT8cutZNvTH+AnjR1wDGjR3e7ij3gYCcW3GYksMRd0Jcnw
xE5DgAdxfYhC+5BYtplMtl0mxCcJ6QjiETFj7YI1fsOcbl4pF8Vn5rbC/DEltRil
sbTDcySN3mkF0Ifniut1gusE+6ID/a/ZpeuP6WFT4KTByUemsdgOk=
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: No, score=-7.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 spammy=H*UA:Firefox, HContent-Transfer-Encoding:8bit
X-HELO: m0.truegem.net
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> <855a9543-6908-42f0-576a-0f161777f715 AT ssi-schaefer DOT com>
From: Mark Geisert <mark AT maxrnd DOT com>
Message-ID: <d5d9f1da-5f42-48d4-d1c8-9ada6bc199e6@maxrnd.com>
Date: Fri, 13 Sep 2019 15:08:20 -0700
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4
MIME-Version: 1.0
In-Reply-To: <855a9543-6908-42f0-576a-0f161777f715@ssi-schaefer.com>

Michael Haubenwallner wrote:
> 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

Thanks for the problem report.  Blame me for this one.  I believe your last 
suggestion is the correct fix but I want to double-check something additional. 
Shortly I'll submit a patch to correct this one way or another.

..mark

--
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