[Numpy-discussion] Building numpy - setting the run path

Peter C. Norton spacey-numpy-discussion@lenin....
Fri Apr 27 17:27:47 CDT 2007

Building numpy for my company's solaris distribution involves requring
a run_path for the lapack+blas libraries we're using (libsunperf,
though I'm considering swapping out for gsl since we may use that).

The situation we're in is that we need gcc to get the -R for paths
like /usr/local/gnu/lib /usr/local/python2.5.1/lib, etc. but the
default python distutils raise a not implemented exception on this.

Since it doesn't appear that the numpy distutils subclass the
ccompiler, my solution is this for now (in numpy/distutils/ccomiler):

def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries):
    r = _distutils_gen_lib_options(compiler, library_dirs,
                                   [], libraries)
    if len(runtime_library_dirs) > 0:
        r.extend([ "-R%s" % lib for lib in runtime_library_dirs ])
    lib_opts = []
    for i in r:
        if is_sequence(i):
    return lib_opts

This allows me to specify -R options on the command line with
build_ext without destroying the build. I'm pretty sure that "-R"
should be replaced with a lookup somewhere for the
platform-appropriate way to do this, but this does work.

Let me know if there's a better way to do this, but if not can this be
incorporated into numpy's distutils?



The 5 year plan:
In five years we'll make up another plan.
Or just re-use this one.

More information about the Numpy-discussion mailing list