On 14/10/2013 10:17 AM, Ryan Johnson wrote:
Hi python maintainer,

Is there any chance to get a build of python 3.3 on x86_64? (I need PEP 380, delegating to a subgenerator, and the Windows version doesn't play nice with cygwin shells). I tried downloading the sources and applying the patches mentioned in the .cygport file for the cygwin python 3.2 source distribution, but make fails with:

./Modules/signalmodule.c: In function ‘fill_siginfo’:
./Modules/signalmodule.c:745:60: error: ‘siginfo_t’ has no member named ‘si_band’
PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(si->si_band));
^
Include/tupleobject.h:62:75: note: in definition of macro ‘PyTuple_SET_ITEM’ #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v)
^
./Modules/signalmodule.c:745:5: note: in expansion of macro ‘PyStructSequence_SET_ITEM’
PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(si->si_band));
^

NOTES:

 * Google turned up several other reports of the same error message,
   going back as far as python 2.6 for cygwin, but all the workarounds
   seem to have been fixed in older versions upstream, and/or fix other
   problems that had no obvious link with si_band (such as using
   ncursesw instead of ncurses).
 * I don't have (or know how to use) cygport, so maybe it would be as
   simple as changing $VERSION in the .cygport file.


Detailed steps I followed:
Update: I installed cygport, waded through various slight incompatibilities in the patches, and verified that the compilation still fails with the same error message. The modified .cygport and updated patches are attached (other patches remain the same as for 3.2).

The steps to repro are now simply:
# download the 3.3.2 source .xz from python.org
$ ./cygport --64 python3-3.cygport prep
$ ./cygport --64 python3-3.cygport compile

Going by this StackOverflow question, si_band is POSIX, though I don't know which version introduced it... the linux man pages suggest POSIX.1-2001. In any case, it looks like si_band is endemic in POSIX systems, but missing in cygwin.

Updating the signal module to no longer expose si_band at all seems to work around the problem (see patch), but compilation still dies (much later) with:

Traceback (most recent call last):
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/setup.py", line 2166, in <module>
    main()
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/setup.py", line 2161, in main
    "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/core.py", line 148, in setup
    dist.run_commands()
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/dist.py", line 929, in run_commands
    self.run_command(cmd)
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/dist.py", line 948, in run_command
    cmd_obj.run()
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/command/build.py", line 126, in run
    self.run_command(cmd_name)
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/dist.py", line 948, in run_command
    cmd_obj.run()
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/command/build_ext.py", line 354, in run
    self.build_extensions()
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/setup.py", line 245, in build_extensions
    build_ext.build_extensions(self)
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/Lib/distutils/command/build_ext.py", line 463, in build_extensions
    self.build_extension(ext)
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/setup.py", line 279, in build_extension
    if not self.configure_ctypes(ext):
File "/usr/src/python3-3.3.2-3/src/Python-3.3.2/setup.py", line 1807, in configure_ctypes
    exec(f.read(), globals(), fficonfig)
  File "<string>", line 33, in <module>
KeyError: 'X86_WIN64'
Makefile:505: recipe for target 'sharedmods' failed

At this point I'm stuck... any advice from the gurus out there would be appreciated.

Thanks,
Ryan

--- origsrc/Python-3.2.3/setup.py       2012-07-19 20:44:59.596311500 -0500
+++ src/Python-3.2.3/setup.py   2012-07-19 20:43:22.069733300 -0500
@@ -1061,6 +1061,6 @@
         dbm_order = ['gdbm']
         # The standard Unix dbm module:
-        if host_platform not in ['cygwin']:
+        if host_platform not in ['win32']:
             config_args = [arg.strip("'")
                            for arg in 
sysconfig.get_config_var("CONFIG_ARGS").split()]
             dbm_args = [arg for arg in config_args
@@ -1111,6 +1111,15 @@ class PyBuildExt(build_ext):
                                     ],
                                 libraries = gdbm_libs)
                             break
+                        if find_file("ndbm.h", inc_dirs, []) is not None:
+                            print("building dbm using gdbm")
+                            dbmext = Extension(
+                                '_dbm', ['_dbmmodule.c'],
+                                define_macros=[
+                                    ('HAVE_NDBM_H', None),
+                                    ],
+                                libraries = gdbm_libs)
+                            break
                 elif cand == "bdb":
                     if db_incs is not None:
                         print("building dbm using bdb")
--- origsrc/Python-3.2.5/configure.ac   2013-07-30 16:39:31.743160000 -0500
+++ src/Python-3.2.5/configure.ac       2013-07-30 18:41:19.375132600 -0500
@@ -3773,7 +3773,7 @@ AC_MSG_RESULT($SOABI)
 
 AC_SUBST(EXT_SUFFIX)
 case $ac_sys_system in
-    Linux*|GNU*)
+    Linux*|GNU*|CYGWIN*)
        EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
     *)
        EXT_SUFFIX=${SHLIB_SUFFIX};;

--- origsrc/Python-3.2.3/Python/dynload_shlib.c 2012-04-11 01:54:08.000000000 
-0500
+++ src/Python-3.2.3/Python/dynload_shlib.c     2012-07-19 20:28:01.691090700 
-0500
@@ -38,5 +38,6 @@
 
 const char *_PyImport_DynLoadFiletab[] = {
 #ifdef __CYGWIN__
+    "." SOABI ".dll",
     ".dll",
 #else  /* !__CYGWIN__ */
--- origsrc/Python-3.0b3/setup.py       2008-07-17 11:23:53.000000000 -0500
+++ src/Python-3.0b3/setup.py   2008-08-20 22:27:08.000000000 -0500
@@ -1363,12 +1363,6 @@
             include_dirs.append('/usr/X11/include')
             added_lib_dirs.append('/usr/X11/lib')
 
-        # If Cygwin, then verify that X is installed before proceeding
-        if host_platform == 'cygwin':
-            x11_inc = find_file('X11/Xlib.h', [], include_dirs)
-            if x11_inc is None:
-                return
-
         # Check for BLT extension
         if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
                                            'BLT8.0'):
@@ -1386,9 +1380,8 @@
         if host_platform in ['aix3', 'aix4']:
             libs.append('ld')
 
-        # Finally, link with the X11 libraries (not appropriate on cygwin)
-        if host_platform != "cygwin":
-            libs.append('X11')
+        # Finally, link with the X11 libraries
+        libs.append('X11')
 
         ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
                         define_macros=[('WITH_APPINIT', 1)] + defs,
NAME="python3"
VERSION=3.3.2
RELEASE=3
CATEGORY="Python Interpreters"
SUMMARY="Py3K language interpreter"
DESCRIPTION="Python is an interpreted, interactive object-oriented
programming language suitable (amongst other uses) for distributed
application development, scripting, numeric computing and system
testing.  Python is often compared to Tcl, Perl, Java, JavaScript,
Visual Basic or Scheme."
HOMEPAGE="http://www.python.org/";
SRC_URI="http://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tar.xz";
SRC_DIR="Python-${VERSION}"
PATCH_URI="
        http://bugs.python.org/file31331/CVE-2013-4238-py32.patch
        3.3-dbm.patch
        3.1-enable-new-dtags.patch
        3.3-tkinter.patch
        3.0rc3-ctypes-util-find_library.patch
        3.1-PATH_MAX.patch
        3.1-ssl-threads.patch
        3.1-ncurses-abi6.patch
        3.2-export-PySignal_SetWakeupFd.patch
        3.2-cygwin-soname.patch
        3.2-distutils-shlibext.patch
        3.2-ctypes-libpython.patch
        3.3-pep3149.patch
        3.2-export-PyNode_SizeOf.patch
        3.2-thread-cygwin64.patch
        3.3-si_band.patch
"
#       3.0b3-ossaudio.patch
#       http://bugs.python.org/file31377/uuid.patch
#       3.2-format-parsetuple.patch

slot=${PV:0:3}
abi=${slot}m
pyrootdir=/usr/lib/python${slot}
pyconfdir=${pyrootdir}/config-${abi}
pydylddir=${pyrootdir}/lib-dynload

PKG_NAMES="${NAME} ${NAME}-test ${NAME}-tkinter idle3"
python3_CONTENTS="--exclude=idle3* --exclude=idlelib --exclude=_tkinter*.dll
                  --exclude=tkinter --exclude=test --exclude=tests
                  --exclude=turtle* usr/"
idle3_SUMMARY="Py3K Tkinter_based IDE"
idle3_CONTENTS="usr/bin/idle3* ${pyrootdir#/}/idlelib/"
python3_test_SUMMARY="Py3K tests"
python3_test_CONTENTS="${pyrootdir#/}/*/test*/ ${pyrootdir#/}/test/ 
${pyrootdir#/}/turtledemo/"
python3_tkinter_SUMMARY="Py3K Tkinter GUI module"
python3_tkinter_REQUIRES="tcl-tix"
python3_tkinter_CONTENTS="--exclude=test ${pydylddir#/}/_tkinter*
                          ${pyrootdir#/}/tkinter/ ${pyrootdir#/}/turtle.py
                          ${pyrootdir#/}/__pycache__/turtle.*"

DIFF_EXCLUDES="plat-cygwin pyconfig.h.in"

NO_AUTOHEADER=1
CPPFLAGS+=" -I/usr/include/ncursesw"
CYGCONF_ARGS="
        --enable-shared
        --enable-ipv6
        --with-dbmliborder=gdbm
        --with-libc=
        --with-libm=
        --with-system-expat
        --with-system-ffi
        ac_cv_func_bind_textdomain_codeset=yes
"

src_install() {
        cd ${B}
        dodir /usr
        cygmake -j1 DESTDIR=${D} altinstall maninstall

        dosym python${abi}.exe /usr/bin/python3
        dosym python${abi}-config /usr/bin/python3-config
        dosym python-${slot}.pc /usr/lib/pkgconfig/python3.pc

        dosym ${pyconfdir#/usr/lib/}/libpython${abi}.dll.a 
/usr/lib/libpython${abi}.dll.a

        dosym idle${slot} /usr/bin/idle3
        dosym pydoc${slot} /usr/bin/pydoc3
        sed -i -e '1 s/\.exe//' ${D}/usr/bin/*${slot}
}
*** python3-3.3.2-3/src/Python-3.3.2/Modules/signalmodule.c.orig        
2013-10-14 21:02:17.372115300 -0400
--- python3-3.3.2-3/src/Python-3.3.2/Modules/signalmodule.c     2013-10-14 
21:03:05.506868400 -0400
***************
*** 709,722 ****
      {"si_pid",          "sending process ID"},
      {"si_uid",          "real user ID of sending process"},
      {"si_status",       "exit value or signal"},
-     {"si_band",         "band event for SIGPOLL"},
      {0}
  };
  
  PyDoc_STRVAR(struct_siginfo__doc__,
  "struct_siginfo: Result from sigwaitinfo or sigtimedwait.\n\n\
  This object may be accessed either as a tuple of\n\
! (si_signo, si_code, si_errno, si_pid, si_uid, si_status, si_band),\n\
  or via the attributes si_signo, si_code, and so on.");
  
  static PyStructSequence_Desc struct_siginfo_desc = {
--- 709,721 ----
      {"si_pid",          "sending process ID"},
      {"si_uid",          "real user ID of sending process"},
      {"si_status",       "exit value or signal"},
      {0}
  };
  
  PyDoc_STRVAR(struct_siginfo__doc__,
  "struct_siginfo: Result from sigwaitinfo or sigtimedwait.\n\n\
  This object may be accessed either as a tuple of\n\
! (si_signo, si_code, si_errno, si_pid, si_uid, si_status),\n\
  or via the attributes si_signo, si_code, and so on.");
  
  static PyStructSequence_Desc struct_siginfo_desc = {
***************
*** 742,748 ****
      PyStructSequence_SET_ITEM(result, 4, _PyLong_FromUid(si->si_uid));
      PyStructSequence_SET_ITEM(result, 5,
                                  PyLong_FromLong((long)(si->si_status)));
-     PyStructSequence_SET_ITEM(result, 6, PyLong_FromLong(si->si_band));
      if (PyErr_Occurred()) {
          Py_DECREF(result);
          return NULL;
--- 741,746 ----

--
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 via email to