[PATCH] Fix build for empty with-python, but with-python-libdir

Alexey Lapshin alexey.lapshin@espressif.com
Tue Oct 26 06:09:55 GMT 2021


On 10/25/21 9:14 PM, Simon Marchi wrote:
> [External: This email originated outside Espressif]
>
> On 2021-10-25 13:53, Alexey Lapshin via Gdb-patches wrote:
>> ---
>>   gdb/python/python.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gdb/python/python.c b/gdb/python/python.c
>> index c81814c557b..9e8e0149ba9 100644
>> --- a/gdb/python/python.c
>> +++ b/gdb/python/python.c
>> @@ -1756,7 +1756,7 @@ gdbpy_gdb_exiting (int exit_code)
>>   static bool
>>   do_start_initialization ()
>>   {
>> -#ifdef WITH_PYTHON_PATH
>> +#ifdef HAVE_PYTHON
>>     /* Work around problem where python gets confused about where it is,
>>        and then can't find its libraries, etc.
>>        NOTE: Python assumes the following layout:
>>
> Hi,
>
> Please provide a commit message that describes the issue that you see
> and that you try to fix.
>
> Simon

Hi,

The issue I faced when compile gdb with python. Configure options are 
--with-python --with-python-libdir=$PYTHON_DIR/lib. The issue appears if 
I do not specify path to python via --with-python option flag.

The problem which I see after the gdb build:
python exception <type 'exceptions.ImportError'> No module named _gdb

Because _gdb is built-in module which loads in block of code under 
"ifdef WITH_PYTHON_PATH".
I changed it to more suitable "ifdef HAVE_PYTHON" and it works perfectly



More information about the Gdb-patches mailing list