[Distutils] Solaris and distutils: Need to pass LIBDIR explicitly with -L when building extensions?
Floris Bruynooghe
floris.bruynooghe at gmail.com
Sat Jan 31 15:01:43 CET 2009
On Fri, Jan 30, 2009 at 05:45:26PM -0600, Dave Peterson wrote:
> Floris Bruynooghe wrote:
>> On Mon, Jan 26, 2009 at 06:48:06PM -0600, Dave Peterson wrote:
>>
>>> I am trying to build a number of projects that use Python extensions
>>> on Solaris 10 and I've discovered that nothing with extensions will
>>> link unless I explicitly pass in a '-L/path/to/python/lib/dir'
>>> because libpython2.5.so is not otherwise found when the
>>> '-lpython2.5' argument is specified during linking.
>>>
>> [...]
>>
>>> If that all seems correct, then it appears the issue is the
>>> finalize_options() source in lib/distutils/commands/build_ext.py.
>>> There are a number of "if" blocks that explicitly append the value
>>> of distutils.sysconfig.get_config_vars('LIBDIR') to the list of
>>> library_dirs used to link built extensions with. However, there
>>> doesn't seem to be one of these for Solaris / sunos.
>>>
>>
>> Could you point to one of the projects you're having trouble with? I
>> haven't had any such problems with Python 2.5 on Solaris 10, distutils
>> always finds the right things when I'm building extension modules.
>>
>
> Pretty much everything I've tried that uses an extension has this
> problem. Cython, Numpy, Traits, etc. As Robert Kern pointed out, I'm
> using a custom built Python (Python 2.5.4) built and installed into a
> custom location via '--prefix'. What Python are you using?
Ah, I get it now. I did cut out the important part: you build with
--enable-shared. I'm also using a custom build Python with --prefix
but don't use --enable-shared so don't get this problem.
> I'm leaning more and more toward this is actually a bug
> with the distutils source on Solaris.
Yes, I agree now that it is a bug in distutils and I agree with your
fix. The if statement should check both that it is SunOS and that it
is using a shared python, just like the linux one. If fact the linux
one could just be modified:
if (sys.paltform.startswith('linux') \
or sys.platform.startswith('gnu') \
or sys.platform.startswith('sunos')) \
and sysconfig.get_config_var('Py_ENABLE_SHARED'):
...
I'll leave the honours of reporting the bug to you if you agree with
this.
Lastly out of curiosity: why --enable-shared? Do you embed python?
Or are there other reasons to use it?
Regards
Floris
--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org
More information about the Distutils-SIG
mailing list