Bug 749392

Summary: Python bundles pre-built windows binaries. Needs to build from source
Product: [Fedora] Fedora Reporter: Toshio Ernie Kuratomi <a.badger>
Component: pythonAssignee: Bohuslav "Slavek" Kabrda <bkabrda>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dmalcolm, ivazqueznet, jonathansteffan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 13:56:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
patch from upstream to lookup an ecoding for building wininst correctly none

Description Toshio Ernie Kuratomi 2011-10-26 22:16:48 UTC
Created attachment 530396 [details]
patch from upstream to lookup an ecoding for building wininst correctly

Description of problem:
The files:
/usr/lib64/python2.7/distutils/command/wininst-6.0.exe
/usr/lib64/python2.7/distutils/command/wininst-7.1.exe
/usr/lib64/python2.7/distutils/command/wininst-8.0.exe
/usr/lib64/python2.7/distutils/command/wininst-9.0-amd64.exe
/usr/lib64/python2.7/distutils/command/wininst-9.0.exe

are included in the python-devel package but they aren't being compiled from source.  At today's FPC meeting, the FPC decided that Windows binaries should be compiled from source as well.  We have a mingw-32 cross-compiler which will let us compile the win32 executables.  We'll have to wait for the mingw-64 stack in order to compile the amd64.exe (and yes, FPC decided we should just not have the 64 bit exe until then).

As background, there's a good deal of hinkiness about these binaries, what they do, and how they achieve it.  I'll summarise a discussion I had with epienbro of the MinGW SIG.  Someone with a Windows box can test further and if our assumptions seem off we can revisit this issue with more data.

According to epienbro we should be able to cross-compile the win32 .exe's with mingw32.  There are some caveats but they probably also apply to upstream in some ways so we're only making the problem slightly worse.

First off, it appears that code compiled with one compiler on windows may or may not work with code compiled using a different compiler.  This includes, not just MinGW but also different versions of Visual C++.  So the whole idea behind wininst.exe may be flawed unless it's entirely statically linked.

Second, eventually we may be able to statically link everything but MSVCRT ( the windows equivalent of libc) which MinGW does not ship.  If everything else is statically linked, this should significantly reduce the problems as MinGW is intended to build binaries which can work with the version of MSVCRT that is found on the user's system.  If it doesn't work, it's a bug that we can have the MinGW folks look into fixing.

Thirdly, with dynamic linking, even upstreams wininst's might still be a problem for distributors as the wininst that I build on my Windows system may detect that I'm building on a system that needs MSVCRT 9.0 but my user's systems may only have MSVCRT 6.0 so the wininst would not necessarily be portable between our systems.  (They may be, but that's where the compiler differences come in again).

Fourthly, in this particular case, we're using LoadLibrary() (roughly equivalent to dlopen in Linux) to load libpython.  That should shield us from some of the undesired effects of being built with two different compilers.

With all that said, what we need to do is rm the .exe's in %prep.  As part of the build, running somethig similar to this to build:

i686-pc-mingw32-gcc -c extract.c -o extract.o
i686-pc-mingw32-gcc -c install.c -o install.o
i686-pc-mingw32-windres install.rc install_rc.o
i686-pc-mingw32-gcc extract.o install.o install_rc.o -o wininst.exe /usr/i686-pc-mingw32/sys-root/mingw/lib/libz.a -luuid -lole32 -lgdi32 -lcomctl32

We'll need to BuildRequire: mingw32-zlib-static mingw32-gcc

Given the above notes about different VC++ versions and mingw, we can try building this and simply linking the various *.exe's together.  I believe that mingw also has the ability to specify a specific version of the CRT to pretend to link against (they're stubs in mingw; the user's windows machine will provide the actual version) but I don't know that that will help us here.


Additional info:

One reason that I don't feel too horribly about doing this is that wininst appears to be broken on Linux right now.  I had to apply a patch from upstream to get it to work: http://bugs.python.org/issue13151#msg145473

I'll add that as an attachment

Comment 1 Fedora End Of Life 2013-04-03 14:36:00 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 2 Fedora Admin XMLRPC Client 2013-05-10 04:59:01 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Fedora Admin XMLRPC Client 2013-05-10 05:00:25 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora End Of Life 2015-01-09 16:50:23 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-02-17 13:56:30 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.