[Pythonmac-SIG] Another build question: ssl?

Dan Wolfe wolfeman@mac.com
Thu, 21 Nov 2002 11:20:15 -0800


Hi All,

There's a problem regarding Ronald's SSL patches - they make setup 
assume that every shared library is a .dylib rather than either a .so 
or .dylib, which breaks compatibility....

After some late night investigation, I found that the source of the 
problem is distutils.  We previously had a problem under Mac OS X where 
it wasn't finding the .dylib libraries for libz and other similar 
.dylib libraries - both user and system installed.  Someone came up 
with a patch and this can be found in /distutils/unixcompiler.py around 
line 278 in the function find_library_file.  Basically, it just adds 
another check to look for .dylib if it can't find the .so file.

The unixcompiler.py file inherits from the ccompiler.py file which has 
a stub routine for this function.  For the longest time I thought the 
function in unixcompiler.py was being called and was pulling my hair 
out trying to figure out why it wasn't being finding the ssl library 
since it only looked for .a and .so files...

It turns out that setup.py also implements a function by the SAME name, 
but with different parameters and instead of returning a true/false to 
indicate whether the library exists, it returns the pathname to the 
library.  This function, unfortunately, was NOT previously modify to 
support dylibs and as a result only .a and .so files would be searched 
for.

Below is a diff that fixes the problem simply by adding another check 
for a dylib file and returning the results if it exists.

lobo% diff -u /Users/lobo/Desktop/Python-2.2.2/setupold.py 
/Users/lobo/Desktop/Python-2.2.2/setup.py
--- /Users/lobo/Desktop/Python-2.2.2/setupold.py        Wed Oct  9 
17:59:16 2002
+++ /Users/lobo/Desktop/Python-2.2.2/setup.py   Thu Nov 21 09:12:43 2002
@@ -44,6 +44,10 @@
      filename = compiler.library_filename(libname, lib_type='shared')
      result = find_file(filename, std_dirs, paths)
      if result is not None: return result
+
+    filename = compiler.library_filename(libname, lib_type='dylib')
+    result = find_file(filename, std_dirs, paths)
+    if result is not None: return result

      filename = compiler.library_filename(libname, lib_type='static')
      result = find_file(filename, std_dirs, paths)

I've minimally tested it using the normal non framework installed and 
it appears to function correctly.

Enjoy.

(Yes, Jack, I'll add this to the bug report! BTW you might want to 
assign it to yourself...)

- Dan


On Wednesday, November 20, 2002, at 03:08  PM, Russell E Owen wrote:

> Ronald Oussoren <oussoren@cistron.nl> wrote:
>
>> find_library_file seems to search for 'libssl.a' and 'libssl.so', and 
>> therefore doesn't find libssl.dylib.
>>
>> After playing around a little I now have a Python (2.3 CVS) that can 
>> use '.dylib' for extension modules. See the end of this message for a 
>> CVS diff...
>
> I tried this and unfortunately found I still didn't have ssl support. 
> Perhaps I didn't clear out enough stuff, first. (I was surprised to 
> find that my new build still had Numeric installed, though I had not 
> explicitly reinstalled it.)