[Python-Dev] Where is this flag coming from?

Guido van Rossum guido@python.org
Wed, 09 Oct 2002 17:18:12 -0400


[Martin]
> For 2.2.2, backing out any setup.py changes to add
> runtime_library_dirs should be taking into consideration.

This sounds like a conservative solution.  There is exactly one such
option, for ssl.  The checkin message:

----------------------------
revision 1.73.4.9
date: 2002/09/30 14:42:29;  author: bwarsaw;  state: Exp;  lines: +2 -1
Add "runtime_library_dirs = ssl_libs" to the _socket Extension
specification so that the proper runtime ld.so path gets compiled into
the extension.  This fixes _socket for Solaris systems with libssl and
libcrypto in non-standard locations and should be fine for other
systems as well.  Closes SF bug #565710.

Forward port candidate for Python 2.3 (I'll work on that).
----------------------------

The diff (apart from a change to __version__) is:

***************
*** 364,369 ****
--- 364,370 ----
              exts.append( Extension('_socket', ['socketmodule.c'],
                                     include_dirs = ssl_incs,
                                     library_dirs = ssl_libs,
+                                    runtime_library_dirs = ssl_libs,
                                     libraries = ['ssl', 'crypto'],
                                     define_macros = [('USE_SSL',1)] ) )
          else:

Maybe we should be more conservative and add this option only for
Solaris?  How does one detect Solaris in setup.py?  How about this
patch (on top of the above one, not replacing it)?

*** setup.py	7 Oct 2002 10:38:33 -0000	1.73.4.10
--- setup.py	9 Oct 2002 21:15:04 -0000
***************
*** 361,370 ****
  
          if (ssl_incs is not None and
              ssl_libs is not None):
              exts.append( Extension('_socket', ['socketmodule.c'],
                                     include_dirs = ssl_incs,
                                     library_dirs = ssl_libs,
!                                    runtime_library_dirs = ssl_libs,
                                     libraries = ['ssl', 'crypto'],
                                     define_macros = [('USE_SSL',1)] ) )
          else:
--- 361,373 ----
  
          if (ssl_incs is not None and
              ssl_libs is not None):
+             rtlibs = None
+             if platform.startswith('sunos'):
+                 rtlibs = ssl_libs
              exts.append( Extension('_socket', ['socketmodule.c'],
                                     include_dirs = ssl_incs,
                                     library_dirs = ssl_libs,
!                                    runtime_library_dirs = rtlibs,
                                     libraries = ['ssl', 'crypto'],
                                     define_macros = [('USE_SSL',1)] ) )
          else:

I hope that Skip/Barry can test this on MacOS X and Martin on Solaris!

Note: the 2.3 setup.py contains other uses of runtime_library_dirs,
which probably need to be treated the same way.  Skip, can you cook up
patches there?  (The 2.2.2 fix for ssl also needs to be forward-ported!)

--Guido van Rossum (home page: http://www.python.org/~guido/)