overriding /usr/lib and /usr/include directories

Bruce Edge bedge at troikanetworks.com
Mon Jun 4 12:48:45 EDT 2001


In article <9f9s05$lgv$0 at 216.39.151.169>, "Donn Cave" <donn at oz.net> wrote:

> Quoth "Bruce Edge" <bedge at troikanetworks.com>: | I'm building python for
> an embedded environment, and it's apparently | picking up the library
> names from /usr/lib. How do I tell it where to look | for shared libs,
> like libreadline.so.4.2 for example? |
> | My host has /usr/lib/libreadline.so.4.1, while in my target env my |
> LD_LIBRARY_PATH points to a dir containing libreadline.so.4.2, and the |
> python readline module  as it's looking for the version it found in |
> /usr/lib.
> 
> Sounds like setup.py to me, though I haven't thought very hard about it
> since you don't say what version of Python or provide much of any other
> details about what you're doing.  Anyway, in 2.1, setup.py builds the
> dynamically loaded modules, and it has /usr/lib hard-coded.  If you want
> something else, you can just modify setup.py accordingly.  I believe
> it's fairly obvious; you may have to dive way down into the distutils
> layer beneath setup.py for some things, but /usr/lib should be right
> there in setup.py.
> 
> 	Donn Cave, donn at oz.net

I am using 2.1

I found I could do it by passing parameters to setup.py:

 %> python setup.py build_ext --help shows

  --library-dirs (-L)  directories to search for external C libraries
                       (separated by ':')

Unfortunaely, Makefile.pre.in just involes it as:

# Build the shared modules
sharedmods: $(PYTHON)
	PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build

which build everything, but does not give you a chance to spec your own
dirs. Also, when invoked with the "build" arg, the -L option is not
available.

By modifying it as follows, and building the build_ext section
separately, you can get is to go look in a different dir.

# Build the shared modules
sharedmods: $(PYTHON)
	PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build_ext -L lib
	PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build

Unfortunately, this is not an option that you can set via ./configure.

So, I got it working, but it's be nice if you could just provide a
--with-libdir option to ./configure.

-Bruce.



More information about the Python-list mailing list