Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 08 May 2002 07:50:01 -0400
From: Jason Tishler <jason@tishler.net>
Subject: Cygwin Python with a static Python library?
To: Cygwin <cygwin@cygwin.com>
Mail-followup-to: Cygwin <cygwin@cygwin.com>
Message-id: <20020508115001.GA1700@tishler.net>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_NZcpxTQ8yMRwYXTB5ARJOg)"
Content-transfer-encoding: 8BIT
User-Agent: Mutt/1.3.24i

--Boundary_(ID_NZcpxTQ8yMRwYXTB5ARJOg)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline

There have been some recent posts on python-list@ regarding whether
or not Cygwin Python should be built with a shared (i.e., DLL) Python
library or a static one.  Note that Cygwin Python currently uses a DLL
library like the Win32 one.

Does anyone have compelling reasons why Cygwin Python needs a static
library?  If so, then I will consider submitting a patch to Python CVS
to enable this for Cygwin.  Unfortunately, it will be difficult to fit
this cleanly into the Python Unix build infrastructure due to the extra
steps required to build an executable that exports symbols with the
current Cygwin binutils.

See attached for more details, if interested.

Thanks,
Jason

--Boundary_(ID_NZcpxTQ8yMRwYXTB5ARJOg)
Content-type: message/rfc822
Content-transfer-encoding: 8BIT

Date: Mon, 06 May 2002 12:59:22 -0400
From: Jason Tishler <jason@tishler.net>
Subject: Re: Creating C modules for Python under Cygwin
In-reply-to: <pNwB8.9120$zW3.232547@news1.tin.it>
To: Alex Martelli <aleax@aleax.it>
Cc: python-list@python.org,
 Martin =?iso-8859-1?Q?v=2E_L=F6wis?= <loewis@informatik.hu-berlin.de>
Mail-followup-to: Alex Martelli <aleax@aleax.it>, python-list@python.org,
 Martin =?iso-8859-1?Q?v=2E_L=F6wis?= <loewis@informatik.hu-berlin.de>
Message-id: <20020506165922.GN1668@tishler.net>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_bKmLZlV7ivR7cd9WCEclyg)"
Content-transfer-encoding: 8BIT
User-Agent: Mutt/1.3.24i
References: <3CD41CC4.5752F30C@wag.caltech.edu>
 <j43cx6ilpq.fsf@informatik.hu-berlin.de> <20020506131744.GD1668@tishler.net>
 <mailman.1020694211.2354.python-list@python.org>
 <pNwB8.9120$zW3.232547@news1.tin.it>


--Boundary_(ID_bKmLZlV7ivR7cd9WCEclyg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 8BIT
Content-disposition: inline

On Mon, May 06, 2002 at 02:53:09PM +0000, Alex Martelli wrote:
> Martin v. Löwis wrote:
> > I think this is what Alex had in mind.
> 
> Alex doesn't understand the details of Cygwin, and dlltool in particular, 
> well enough to be certain, but it sure looks something like what I was
> saying should be doable, yes.
> [snip]

OK, I got it to work.  My previous procedure was incorrect because it did
not get python.exe to export any symbols.  The new (still quick and dirty)
procedure is as follows:

    $ configure --disable-shared
    $ make python.exe # [1]
    $ mkexp.sh        # [2]
    $ make            # [3]

Notes:

    [1] make will stop after python.exe is built but before the shared
        extensions are.
    [2] Rebuild python.exe to export all appropriate symbols.  The
        attached shell script, mkexp.sh, just blindly follows the
        procedure used by Cygwin PostgreSQL to export symbols from an
        executable.  I admit to not fully grokking this procedure (yet).
        Additionally, there may be better, more modern ways (i.e., gcc
        -shared) of accomplishing the same results.  I will investigate
        further.
    [3] Continue make to build the shared extensions.

A Cygwin Python with a static Python library built with the above
procedure successfully loads shared extensions and passes all regression
tests.

I intend to submit a patch to Python CVS with a clean version of the
above.  However my motivation would be greater, if I actually knew of
someone who is really interested in this functionality.  Is there anyone?

Thanks,
Jason

--Boundary_(ID_bKmLZlV7ivR7cd9WCEclyg)
Content-type: application/x-sh; NAME=mkexp.sh
Content-transfer-encoding: quoted-printable
Content-disposition: attachment; filename=mkexp.sh

#!/bin/sh=0A=0A# Echo commands as executed=0Aset -x =0A=0A# Create the def =
file=0Adlltool --export-all --output-def python2.3.def Modules/getbuildinfo=
o Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parse=
r/parser.o Parser/parsetok.o Parser/tokenizer.o Parser/bitset.o Parser/meta=
grammar.o Parser/myreadline.o Objects/abstract.o Objects/boolobject.o Objec=
ts/bufferobject.o Objects/cellobject.o Objects/classobject.o Objects/cobjec=
t.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Obje=
cts/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcob=
ject.o Objects/intobject.o Objects/iterobject.o Objects/listobject.o Object=
s/longobject.o Objects/dictobject.o Objects/methodobject.o Objects/moduleob=
ject.o Objects/object.o Objects/obmalloc.o Objects/rangeobject.o Objects/sl=
iceobject.o Objects/stringobject.o Objects/structseq.o Objects/tupleobject.=
o Objects/typeobject.o Objects/weakrefobject.o Objects/unicodeobject.o Obje=
cts/unicodectype.o Python/bltinmodule.o Python/exceptions.o Python/ceval.o =
Python/compile.o Python/codecs.o Python/errors.o Python/frozen.o Python/fro=
zenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getc=
opyright.o Python/getmtime.o Python/getplatform.o Python/getversion.o Pytho=
n/graminit.o Python/import.o Python/importdl.o Python/marshal.o Python/mods=
upport.o Python/mystrtoul.o Python/mysnprintf.o Python/pyfpe.o Python/pysta=
te.o Python/pythonrun.o Python/structmember.o Python/symtable.o Python/sysm=
odule.o Python/traceback.o Python/getopt.o Python/dynload_shlib.o Python/th=
read.o Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o=
 Modules/threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Module=
s/_sre.o Modules/newmodule.o Modules/symtablemodule.o Modules/xxsubtype.o=
=0A=0A# Create the import library=0Adlltool --dllname python.exe --def pyth=
on2.3.def --output-lib libpython2.3.dll.a=0A=0A# Create the export file=0Ad=
lltool --dllname python.exe --output-exp python2.3.exp --def python2.3.def=
=0A=0A# Create the base file=0Agcc -o python.exe -Wl,--base-file,python2.3.=
base python2.3.exp Modules/python.o libpython2.3.a -lutil -lm=0A=0A# Create=
 the export file (again) but incorporate the base file=0Adlltool --dllname =
python.exe --base-file python2.3.base --output-exp python2.3.exp --def pyth=
on2.3.def=0A=0A# Create python.exe that exports the appropriate symbols=0Ag=
cc -o python.exe python2.3.exp Modules/python.o libpython2.3.a -lutil -lm=
=0A=0A=

--Boundary_(ID_bKmLZlV7ivR7cd9WCEclyg)--


--Boundary_(ID_NZcpxTQ8yMRwYXTB5ARJOg)
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--Boundary_(ID_NZcpxTQ8yMRwYXTB5ARJOg)--
