Python3.4 detection on 9.6 configuration - Mailing list pgsql-hackers

From Lou Picciano
Subject Python3.4 detection on 9.6 configuration
Date
Msg-id 1997437432.3661037.1475068310057.JavaMail.zimbra@comcast.net
Whole thread Raw
In response to Re: Tracking wait event for latches  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Python3.4 detection on 9.6 configuration
List pgsql-hackers
PostgreSQL Friends:

Trying to build 9.6RC1, with Python3.4, on OpenIndiana (Illumos). It seems the detection of shared library status of the .so has changed. This appears to be related to a different(?) elucidation of python configuration.

A 'hardwired' change to the configure script to trap platform 'solaris' will work, but this seems the inappropriate approach.

Would be happy to work through this here - I'd like to make it a small 'contribution'.

Clipped from configure script:

  1. { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link an embedded Python application" >&5
  2. $as_echo_n "checking how to link an embedded Python application... " >&6; }
  3.  
  4. python_libdir=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBDIR'))))"`
  5. python_ldlibrary=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LDLIBRARY'))))"`
  6. python_so=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('SO'))))"`
  7. echo "-----"
  8. echo "-----  LOU MOD: python_so: $python_so"
  9. echo "-----"
  10.  
  11. configure finds '.so' on Python2.7
  12. configure finds '.cpython-34m.so' on Python3.4
  13.  
  14. ------------- LATER in the config script, the following 'hardwired' change will 'fix' this, but is likely not the right approach:
  15. (our Python _is_ built as a shared lib. So, this is wonky, but it will work: )
  16.  
  17.   # We need libpython as a shared library.  With Python >=2.5, we
  18.   # check the Py_ENABLE_SHARED setting.  On Debian, the setting is not
  19.   # correct before the jessie release (http://bugs.debian.org/695979).
  20.   # We also want to support older Python versions.  So as a fallback
  21.   # we see if there is a file that is named like a shared library.
  22.  
  23.   if test "$python_enable_shared" != 1; then
  24.     if test "$PORTNAME" = darwin; then
  25.       # macOS does supply a .dylib even though Py_ENABLE_SHARED does
  26.       # not get set.  The file detection logic below doesn't succeed
  27.       # on older macOS versions, so make it explicit.
  28.       python_enable_shared=1
  29.     elif test "$PORTNAME" = win32; then
  30.       # Windows also needs an explicit override.
  31.       python_enable_shared=1
  32.     #  ----- MOD BY LOU: ----------------------------------------
  33.     elif test "$PORTNAME" = solaris; then
  34.       # Solaris explicit override.
  35.       python_enable_shared=1
  36.     else
  37.       # We don't know the platform shared library extension here yet,
  38.       # so we try some candidates.
  39.       for dlsuffix in .so .sl; do
  40.         if ls "$python_libdir"/libpython*${dlsuffix}* >/dev/null 2>&1; then
  41.           python_enable_shared=1
  42.           break
  43.         fi
  44.       done
  45.     fi
  46.   fi

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Tracking wait event for latches
Next
From: Peter Eisentraut
Date:
Subject: Re: Logical Replication WIP