Is it possible to statically link python into gdb?

Hector Oron
Wed Jun 25 14:58:00 GMT 2014


2014-06-25 16:36 GMT+02:00 Joel Brobecker <>:
>> I admit that I have to make a compromise here. I am delivering gdb to
>> my customer and my expectation is that they can use my gdb with python
>> support no matter there is python in their system and no matter the
>> version of their installed python. After a lot of attempts, I think I
>> can't reach my expectation. I guess I have to live with my above
>> workaround.
> What we do is statically link Python into GDB, and then distribute
> both GDB + Python. As long as the path to Python is inside the
> configured prefix, the path to the Python libraries should be
> "relocatable", allowing users to install the binary package anywhere
> and GDB will always find them.

Wouldn't it be better if python was loaded as external plugin, that
way user/admin can pick up which python version they want to use along

In my use case, when distributing GDB some users want it to still be
using python2, some others want to move forward and start moving, i.e.
pretty printers, etc.. to use python3 instead. How could we get both
kind of users happy? Nowadays I am thinking on providing 2 different
builds per each python version, but maybe this should be better loaded
via plugin framework, which I am unsure if that currently exists on

 Héctor Orón  -.. . -... .. .- -.   -.. . ...- . .-.. --- .--. . .-.

More information about the Gdb mailing list