[Distutils] Solaris and distutils: Need to pass LIBDIR explicitly with -L when building extensions?
Dave Peterson
dpeterson at enthought.com
Tue Jan 27 01:48:06 CET 2009
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. This doesn't seem right as I don't have to
specify this explicitly on Linux or Windows.
Admittedly I'm using a custom built Python, so perhaps I missed some
configure argument? Here's my Python build process:
./configure --prefix=/home/dpeterson/py/build --enable-shared
make
make test
make install
It is built with the gcc provided by Sun in a default install of Solaris
10, which means the gcc compiler and the sun linker. "gcc -v" gives:
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
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. Is this just an
oversite? I've verified that adding a simple block with a 'sunos' value
gate solves the problem and I no longer need to be explicit about
providing '-L'. Am I missing something or should this patch be
submitted as a bugfix on the issue tracker?
-- Dave
More information about the Distutils-SIG
mailing list