public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mark Geisert <mark@maxrnd.com>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] cygwin 3.1.0-0.4 (TEST)
Date: Fri, 13 Sep 2019 22:14:00 -0000	[thread overview]
Message-ID: <d5d9f1da-5f42-48d4-d1c8-9ada6bc199e6@maxrnd.com> (raw)
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

  reply	other threads:[~2019-09-13 22:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 13:17 Ken Brown
2019-09-13 18:39 ` Michael Haubenwallner
2019-09-13 22:14   ` Mark Geisert [this message]
2019-09-16 11:54     ` Michael Haubenwallner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5d9f1da-5f42-48d4-d1c8-9ada6bc199e6@maxrnd.com \
    --to=mark@maxrnd.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).