[Distutils] Cygwin Python Distutils Build Problem

Jason Tishler Jason.Tishler@dothill.com
Thu Feb 22 10:43:01 2001


On Thu, Feb 22, 2001 at 10:50:21AM +0100, Rene Liebscher wrote:
> > I think the default compiler if the platform is not found in the
> > dictionary,
> > is 'unix'.
> > So it might be better to use "cygwin.*":"unix" instead of
> > "cygwin.*":"cygwin".

One downside to the above or put another way one good thing about using
cygwinccompiler.py instead of unixccompiler.py for Cygwin is that .def
files were automatically created.  This could be helpful with building
shared extensions that were originally created (and only concerned with
running) on UNIX and are missing the DL_EXPORT macro when defining their
initialization function.  I had to submit numerous patches to SF to
correct nits like this.

Is there a good way to "blend" the cygwinccompiler.py and unixccompiler.py

> >     2. The current cygwinccompiler.py (around line 97) has some hardcoded
> >        gcc options (i.e., using -static instead -shared) that appear to
> >        be out of date.  Should these be revisited too?
> Some of these option were needed as workarounds for several bugs in the
> versions of gcc I tested. (There was last year a version of gcc2.95
> which
> tried to link pythonXX.dll instead libpythonXX.a, this is the reason for
> the -static option.)
> We could use the version information to decide if using for an older gcc
> the hardcoded option or for a newer something generic.
> But then we should have a way to find out all of the version
> information,
> currently you get 2,95,2 for 2.95.2-X. (And at least the first versions
> of
> 2.95.2 had some bugs. So how find out X?)

Older Cygwin versions didn't indicate the "-X" in the "--version"
output, but the newer ones do.  For example,

    $ gcc --version

So may be cygwinccompiler.py could key off of this information with the
following algorithm:

    If the version of gcc is 2.95.2-6 or greater, then use the new
    options; otherwise, use the old ones.

Note that the new options still need to be determined...

> > During compilation, we now are/have:
> > 
> >     missing -DUSE_DL_IMPORT option (i.e., CCSHARED variable)
> >     extraneous -mcygwin -mdll options
> > 
> > During linking, we now are/have:
> > 
> >     missing -shared -Wl,--enable-auto-image-base options
> >     extraneous -mcygwin -mdll -static -s options
> > 
> See above why some of these options are there. I also have to confess I
> am not
> a specialist with cygwin. If there are other better options (and run
> also with
> last years version of gcc) then try it and provide a patch for it.

OK, but I'm not that motivated (at the moment) because I don't normally
build MSVC extensions.  If you do get motivated, then I'll try to see if
there are better options to use.

> > If I use the latest CVS but downgrade Lib/distutils/ccompiler.py to
> > 1.37, then the build succeeds.
> 1.37 is using unixccompiler.py and 1.38 cygwinccompiler.py.

I know, the point of the above was to clearly demonstrate to Marc that
his latest patch to ccompiler.py was causing the problem.


Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com