pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/56161: python3.8 build issue on Solaris 10



The following reply was made to PR pkg/56161; it has been noted by GNATS.

From: =?utf-8?q?Claes_N=C3=A4st=C3=A9n?= <pekdon%gmail.com@localhost>
To: gnats-bugs <gnats-bugs%netbsd.org@localhost>
Cc: 
Subject: Re: pkg/56161: python3.8 build issue on Solaris 10
Date: Wed, 24 Nov 2021 21:52:21 +0100

 --=-1637787141-163853-10393-2638-5-=
 Content-Type: text/plain; charset=UTF-8
 Content-Disposition: inline
 
 Excerpts from gnats-admin's message of 2021-05-09 17:20:00 +0000:
 > Thank you very much for your problem report.
 > It has the internal identification `pkg/56161'.
 > The individual assigned to look at your
 > report is: pkg-manager. 
 > 
 > >Category:       pkg
 > >Responsible:    pkg-manager
 > >Synopsis:       python3.8 build issue on Solaris 10
 > >Arrival-Date:   Sun May 09 17:20:00 +0000 2021
 
 Another approach, against 3.9, being a bit more restrictive avoiding any
 changes on more current Solarish variants.
 
 If this is acceptable I can provide patches for the Python versions in
 pkgsrc.
 
 
 --=-1637787141-163853-10393-2638-5-=
 Content-Disposition: attachment; filename="patch-Modules_socketmodule.c"
 Content-Type: text/plain; name="patch-Modules_socketmodule.c"
 Content-Transfer-Encoding: quoted-printable
 
 $NetBSD: patch-Modules_socketmodule.c,v 1.2 2021/05/22 11:36:01 bouyer Ex=
 p $
 
 Support NetBSD's socketcan implementation
 
 --- Modules/socketmodule.c.orig	2021-11-15 17:43:00.000000000 +0000
 +++ Modules/socketmodule.c
 @@ -2154,7 +2154,7 @@ getsockaddrarg(PySocketSockObject *s, Py
              PyObject *interfaceName;
              struct ifreq ifr;
              Py_ssize_t len;
 -            struct sockaddr_can *addr =3D &addrbuf->can;
 +            struct sockaddr_can *addr =3D (struct sockaddr_can *)addrbuf=
 ;
  =
 
              if (!PyTuple_Check(args)) {
                  PyErr_Format(PyExc_TypeError,
 @@ -5489,7 +5489,7 @@ socket_sethostname(PyObject *self, PyObj
      Py_buffer buf;
      int res, flag =3D 0;
  =
 
 -#ifdef _AIX
 +#if defined(_AIX) || defined(SOLARIS_PRE_11)
  /* issue #18259, not declared in any useful header file */
  extern int sethostname(const char *, size_t);
  #endif
 @@ -7824,6 +7824,20 @@ PyInit__socket(void)
  =
 
      PyModule_AddIntMacro(m, J1939_FILTER_MAX);
  #endif
 +#ifdef HAVE_NETCAN_CAN_H
 +    PyModule_AddIntMacro(m, CAN_EFF_FLAG);
 +    PyModule_AddIntMacro(m, CAN_RTR_FLAG);
 +    PyModule_AddIntMacro(m, CAN_ERR_FLAG);
 +
 +    PyModule_AddIntMacro(m, CAN_SFF_MASK);
 +    PyModule_AddIntMacro(m, CAN_EFF_MASK);
 +    PyModule_AddIntMacro(m, CAN_ERR_MASK);
 +
 +    PyModule_AddIntMacro(m, CAN_RAW_FILTER);
 +    /* PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER); */
 +    PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
 +    PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
 +#endif
  #ifdef SOL_RDS
      PyModule_AddIntMacro(m, SOL_RDS);
  #endif
 
 --=-1637787141-163853-10393-2638-5-=
 Content-Disposition: attachment; filename="patch-setup.py"
 Content-Type: application/x-python; name="patch-setup.py"
 Content-Transfer-Encoding: 8bit
 
 $NetBSD: patch-setup.py,v 1.5 2021/11/06 12:24:35 adam Exp $
 
 Disable certain modules, so they can be built as separate packages.
 Do not look for ncursesw.
 Assume panel_library is correct; this is a fix for ncurses' gnupanel
 which will get transformed to panel in buildlink.
 
 --- setup.py.orig	2021-11-15 17:43:00.000000000 +0000
 +++ setup.py
 @@ -30,7 +30,7 @@ except ImportError:
      SUBPROCESS_BOOTSTRAP = True
  
  
 -from distutils import log
 +from distutils import log, text_file
  from distutils.command.build_ext import build_ext
  from distutils.command.build_scripts import build_scripts
  from distutils.command.install import install
 @@ -44,7 +44,7 @@ from distutils.spawn import find_executa
  TEST_EXTENSIONS = True
  
  # This global variable is used to hold the list of modules to be disabled.
 -DISABLED_MODULE_LIST = []
 +DISABLED_MODULE_LIST = ["_curses", "_curses_panel", "_elementtree", "_gdbm", "pyexpat", "readline", "_sqlite3", "_tkinter", "xxlimited"]
  
  
  def get_platform():
 @@ -65,7 +65,13 @@ CYGWIN = (HOST_PLATFORM == 'cygwin')
  MACOS = (HOST_PLATFORM == 'darwin')
  AIX = (HOST_PLATFORM.startswith('aix'))
  VXWORKS = ('vxworks' in HOST_PLATFORM)
 -
 +if HOST_PLATFORM == 'sunos5':
 +    # not using -o to check for variant here as -o is unsupported on
 +    # Solaris 10
 +    uname = sys.modules['subprocess'].check_output(['uname', '-r'])
 +    SOLARIS_PRE_11 = uname[:4] != '5.11'
 +else:
 +    SOLARIS_PRE_11 = False
  
  SUMMARY = """
  Python is an interpreted, interactive, object-oriented programming
 @@ -224,6 +230,16 @@ def grep_headers_for(function, headers):
                  return True
      return False
  
 +def grep_headers_for(function, headers):
 +    for header in headers:
 +        try:
 +            with open(header, 'r') as f:
 +                if function in f.read():
 +                    return True
 +        except UnicodeDecodeError:
 +            pass
 +    return False
 +
  def find_file(filename, std_dirs, paths):
      """Searches for the directory where a given file is located,
      and returns a possibly-empty list of additional directories, or None
 @@ -728,15 +744,15 @@ class PyBuildExt(build_ext):
                          add_dir_to_list(dir_list, directory)
  
      def configure_compiler(self):
 -        # Ensure that /usr/local is always used, but the local build
 -        # directories (i.e. '.' and 'Include') must be first.  See issue
 -        # 10520.
 -        if not CROSS_COMPILING:
 -            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
 -            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
 -        # only change this for cross builds for 3.3, issues on Mageia
 -        if CROSS_COMPILING:
 -            self.add_cross_compiling_paths()
 +        # Add the buildlink directories for pkgsrc
 +        if os.environ.get('BUILDLINK_DIR'):
 +            dir = os.environ['BUILDLINK_DIR']
 +            libdir = dir + '/lib'
 +            incdir = dir + '/include'
 +            if libdir not in self.compiler.library_dirs:
 +                self.compiler.library_dirs.insert(0, libdir)
 +            if incdir not in self.compiler.include_dirs:
 +                self.compiler.include_dirs.insert(0, incdir)
          self.add_multiarch_paths()
          self.add_ldflags_cppflags()
  
 @@ -784,6 +800,9 @@ class PyBuildExt(build_ext):
              self.lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
  
          if MACOS:
 +            self.inc_dirs.append(macosx_sdk_root() + '/usr/include')
 +            self.lib_dirs.append(macosx_sdk_root() + '/usr/lib')
 +
              # This should work on any unixy platform ;-)
              # If the user has bothered specifying additional -I and -L flags
              # in OPT and LDFLAGS we might as well use them here.
 @@ -1001,8 +1020,6 @@ class PyBuildExt(build_ext):
          # use the same library for the readline and curses modules.
          if 'curses' in readline_termcap_library:
              curses_library = readline_termcap_library
 -        elif self.compiler.find_library_file(self.lib_dirs, 'ncursesw'):
 -            curses_library = 'ncursesw'
          # Issue 36210: OSS provided ncurses does not link on AIX
          # Use IBM supplied 'curses' for successful build of _curses
          elif AIX and self.compiler.find_library_file(self.lib_dirs, 'curses'):
 @@ -1104,8 +1121,7 @@ class PyBuildExt(build_ext):
          # If the curses module is enabled, check for the panel module
          # _curses_panel needs some form of ncurses
          skip_curses_panel = True if AIX else False
 -        if (curses_enabled and not skip_curses_panel and
 -                self.compiler.find_library_file(self.lib_dirs, panel_library)):
 +        if curses_enabled and not skip_curses_panel:
              self.add(Extension('_curses_panel', ['_curses_panel.c'],
                             include_dirs=curses_includes,
                             define_macros=curses_defines,
 @@ -1121,7 +1137,9 @@ class PyBuildExt(build_ext):
              # the encryption.
              return
  
 -        if self.compiler.find_library_file(self.lib_dirs, 'crypt'):
 +        if SOLARIS_PRE_11 and self.compiler.find_library_file(self.lib_dirs, 'crypt_i'):
 +            libs = ['crypt_i']
 +        elif self.compiler.find_library_file(self.lib_dirs, 'crypt'):
              libs = ['crypt']
          else:
              libs = []
 @@ -1136,6 +1154,8 @@ class PyBuildExt(build_ext):
              if MACOS:
                  # Issue #35569: Expose RFC 3542 socket options.
                  kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542']
 +            elif SOLARIS_PRE_11:
 +                kwargs['extra_compile_args'] = ['-DSOLARIS_PRE_11=1']
  
              self.add(Extension('_socket', ['socketmodule.c'], **kwargs))
          elif self.compiler.find_library_file(self.lib_dirs, 'net'):
 @@ -1356,6 +1376,31 @@ class PyBuildExt(build_ext):
          dbm_order = ['gdbm']
          # The standard Unix dbm module:
          if not CYGWIN:
 +            # Top half based on find_file
 +            def find_ndbm_h(dirs):
 +                ret = None
 +                if MACOS:
 +                    sysroot = macosx_sdk_root()
 +                for dir in dirs:
 +                    f = os.path.join(dir, 'ndbm.h')
 +                    if MACOS and is_macosx_sdk_path(dir):
 +                        f = os.path.join(sysroot, dir[1:], 'ndbm.h')
 +                    if not os.path.exists(f):
 +                        continue
 +
 +                    ret = True
 +                    input = text_file.TextFile(f)
 +                    while True:
 +                        line = input.readline()
 +                        if not line:
 +                            break
 +                        if re.search('This file is part of GDBM', line):
 +                            ret = None
 +                            break
 +                    input.close()
 +                    break
 +                return ret
 +
              config_args = [arg.strip("'")
                             for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
              dbm_args = [arg for arg in config_args
 @@ -1367,7 +1412,7 @@ class PyBuildExt(build_ext):
              dbmext = None
              for cand in dbm_order:
                  if cand == "ndbm":
 -                    if find_file("ndbm.h", self.inc_dirs, []) is not None:
 +                    if find_ndbm_h(self.inc_dirs) is not None:
                          # Some systems have -lndbm, others have -lgdbm_compat,
                          # others don't have either
                          if self.compiler.find_library_file(self.lib_dirs,
 @@ -2207,10 +2252,7 @@ class PyBuildExt(build_ext):
              sources = ['_decimal/_decimal.c']
              depends = ['_decimal/docstrings.h']
          else:
 -            include_dirs = [os.path.abspath(os.path.join(self.srcdir,
 -                                                         'Modules',
 -                                                         '_decimal',
 -                                                         'libmpdec'))]
 +            include_dirs = ['Modules/_decimal/libmpdec']
              libraries = ['m']
              sources = [
                '_decimal/_decimal.c',
 @@ -2595,7 +2637,7 @@ def main():
            # If you change the scripts installed here, you also need to
            # check the PyBuildScripts command above, and change the links
            # created by the bininstall target in Makefile.pre.in
 -          scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
 +          scripts = ["Tools/scripts/pydoc3",
                       "Tools/scripts/2to3"]
          )
  
 
 --=-1637787141-163853-10393-2638-5-=--
 


Home | Main Index | Thread Index | Old Index