This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author smani
Recipients eric.araujo, smani, tarek
Date 2012-12-23.12:36:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356266166.76.0.178044154393.issue16754@psf.upfronthosting.co.za>
In-reply-to
Content
I'm using Python3 as available in Fedora rawhide 
(python3-3.3.0-2.fc19.x86_64).

Attempting to build a project using python3/distutils, I noticed that 
find_library_file would not find any library at all. Some investigation 
showed that this was due to the fact that libraries were searched with 
the ".cpython-33m.so" extension. Even more investigation showed that the 
library extension was read being overridden by the one defined in the 
/usr/lib64/python3.3/config-3.3m/Makefile shipped by python3-libs. See 
below for the detailed analysis. The python-versioned extension 
obviously makes no sense for regular shared objects which are not python 
binary modules, so this is clearly wrong. As a workaround I patched 
sysconfig.py to comment out customize_compiler::235 (compiler.shared_lib_extension = 
so_ext, see below), recompiled python (all tests still pass), and things seem to work.


Detailed analysis:

setup.py:
def _find_library_file(self, library):
     return self.compiler.find_library_file(self.compiler.library_dirs, 
library)

---
In function 
/usr/lib64/python3.3/distutils/unixcompiler.py at find_library_file::266:
shared_f = self.library_filename(lib, lib_type='shared')

In function 
/usr/lib64/python3.3/distutils/ccompiler.py at library_filename::882:
ext = getattr(self, lib_type + "_lib_extension")

-> Where does shared_lib_extension get defined?
* At /usr/lib64/python3.3/distutils/ccompiler.py::66
shared_lib_extension = None   -> default for abstract class
* At /usr/lib64/python3.3/distutils/unixcompiler.py::77
shared_lib_extension = ".so"  -> this is the correct value
* In function 
/usr/lib64/python3.3/distutils/sysconfig.py at customize_compiler::235
by /usr/lib64/python3.3/distutils/sysconfig.py at customize_compiler::235
         compiler.shared_lib_extension = so_ext
by /usr/lib64/python3.3/distutils/sysconfig.py at customize_compiler::194
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
             get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
                             'CCSHARED', 'LDSHARED', 'SO', 'AR', 'ARFLAGS'))
by /usr/lib64/python3.3/distutils/sysconfig.py at get_config_vars::530
526 global _config_vars
527     if _config_vars is None:
528         func = globals().get("_init_" + os.name)  # -> os.name = posix
529         if func:
530             func()  # -> _init_posix, populates _config_vars
by /usr/lib64/python3.3/distutils/sysconfig.py at _init_posix::439
435     g = {}
436     # load the installed Makefile:
437     try:
438         filename = get_makefile_filename()  # 
/usr/lib64/python3.3/config-3.3m/Makefile
439         parse_makefile(filename, g)
...
476     global _config_vars
477     _config_vars = g  # -> _config_vars["SO"] = ".cpython-33m.so"
by /usr/lib64/python3.3/config-3.3m/Makefile::122
SO=             .cpython-33m.so
History
Date User Action Args
2012-12-23 12:36:06smanisetrecipients: + smani, tarek, eric.araujo
2012-12-23 12:36:06smanisetmessageid: <1356266166.76.0.178044154393.issue16754@psf.upfronthosting.co.za>
2012-12-23 12:36:06smanilinkissue16754 messages
2012-12-23 12:36:05smanicreate