This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] Add gdb_libdir/python-<version> in front of Python search path.
> I think(!) this is a better approach. Could be wrong of course. :-)
> I think adding one directory to sys.path is insufficient, and from
> what I've read it seems like Py_SetProgramName is the preferred
> solution to this problem.
ISTM for your research (thank you!) that not only is this a better
solution, but most likely the only really viable solution. We're going
to have to go with ${gdb_libdir=<prefix>/lib/gdb}/python/lib/python2.6.
> This patch doesn't currently handle your case, where the relationship
> between the location of python and gdb at build time is different than
> at runtime. I think the solution to that is another config parameter
> to specify where to find python at run time. Currently, when given a
> path, --with-python specifies where to find python at build time, and,
> for now, also at runtime.
> I can create another patch to add this new option
> (--with-python-libdir or some such) if you think it's worth pursuing.
I think we can work around it, by simply making sure that python is
already installed at desired location relative to the prefix used
for configuration. In any case, if I need the extra option, I can
take care of that part.
> Regardless of whether --with-python-libdir is useful to add to the FSF
> tree, I think the attached patch is worthy.
I agree.
> 2010-05-21 Doug Evans <dje@google.com>
>
> Allow python to find its files if moved from original location.
> * acinclude.m4 (GDB_AC_DEFINE_RELOCATABLE): New function.
> (GDB_AC_WITH_DIR): Call it.
> * configure.ac: If a path is provided to --with-python,
> define WITH_PYTHON_PATH.
> * config.in: Regenerate.
> * configure: Regenerate.
> * defs.h (python_libdir): Declare.
> * main.c (python_libdir): Define.
> (captured_main): Initialize python_libdir.
> * python/python.c (_initialize_python): If configured with
> --with-python=/path, call Py_SetProgramName to make sure python
> can find its libraries and modules.
I read the patch as carefully as I could, and nothing jumped out.
--
Joel