public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Mark Geisert <mark@maxrnd.com>
To: cygwin-developers@cygwin.com
Subject: Re: Failure during build of Python 3.8 via cygport
Date: Mon, 14 Dec 2020 02:42:30 -0800	[thread overview]
Message-ID: <0f498c92-409b-6ac8-d0ba-93ac753ab4b8@maxrnd.com> (raw)
In-Reply-To: <758d2138-587b-2970-6c35-69d5c655a598@maxrnd.com>

[Bringing this thread over from cygwin-apps...]

Mark Geisert wrote:
> Mark Geisert wrote:
>> This seems to be a problem setting up a platform-specific build directory. The 
>> sysconfig.py script wants to use "lib." + platform + pythonversion but the 
>> platform string somehow gets corrupted into non-utf8 bytes.  For instance, 
>> building Python 3.8 comes up with:
>>      lib.cygwin-\365\377\377o-\377o-3.8
>> as the directory name.  Broken, but could work.  The build failure happens 
>> because the script tries to write this directory name into a file but it's not a 
>> valid utf8 string.  The directory name should have been:
>>      lib.cygwin-3.2.0-x86_64-3.8
> 
> And the corruption is due to something about a recent change to the operation of 
> Cygwin's uname() function.  The change was introduced in Cygwin API version 335; 
> I'm running 340 on my test machine.  This being a fairly recent change might 
> possibly explain why nobody else has run into this issue yet.
> 
> Basically, os.uname within Python is calling Cygwin's uname() passing the address 
> of a buffer declared to be 'struct utsname'.  The structure layout changed in API 
> 335.  What I've hit is a mismatch between what Python expects and Cygwin delivers.

Brian Inglis pointed out the API 335 change was made a couple years ago, so strike 
the quoted conjecture about why nobody else has hit this.  A new conjecture follows...

Debugging Python's os.uname showed Cygwin's uname() being called with a 'struct 
uname' as defined in /usr/include/sys/utsname.h, which is fine.  But it's the 
"old" pre-335 uname() interface being called, not the "new" 335+ interface 
uname_x().  Note that the famous 'mkimport' script, used when building the Cygwin 
DLL, has an arg "--replace=uname=uname_x" which I believe is supposed to equate 
the two names so the code in uname_x() is called whether the interface is 
uname_x() or uname().  That's not happening.

My first thought was, dang it, my "optimizations" of mkimport broke it.  But 
that's not the case.  Restoring a previous version of mkimport doesn't help.

'nm' shows that both uname and uname_x exist in libcygwin.a and also cygdll.a. 
And a newly-created Cygwin DLL has both functions, with different addresses.
That's wrong, isn't it?

..mark

       reply	other threads:[~2020-12-14 10:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a7bcec5f-b01b-c1e4-81e6-1990f11e351e@maxrnd.com>
     [not found] ` <Pine.BSF.4.63.2012112223120.53260@m0.truegem.net>
     [not found]   ` <758d2138-587b-2970-6c35-69d5c655a598@maxrnd.com>
2020-12-14 10:42     ` Mark Geisert [this message]
2020-12-14 11:33       ` Corinna Vinschen
2020-12-15  8:06         ` Mark Geisert
2020-12-15  8:52           ` Marco Atzeri
2020-12-15  9:07             ` Mark Geisert
2020-12-15 12:06           ` Corinna Vinschen
2020-12-15 12:14             ` Corinna Vinschen

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=0f498c92-409b-6ac8-d0ba-93ac753ab4b8@maxrnd.com \
    --to=mark@maxrnd.com \
    --cc=cygwin-developers@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).