Re: how to build gdb-7.1 --with-python?

Steffen Dettmer
2010-06-28T11:04:40Z

On Fri, Jun 25, 2010 at 7:12 PM, Tom Tromey <tromey@redhat.com> wrote:
>
> Steffen> checking for python2.5... no
> Steffen> checking for python2.4... no
> Steffen> configure: error: python is missing or unusable
>
> Try --with-python=/usr/local

Again, configure worked, but make failed after a while.

configure: WARNING: expat support disabled; some features may be
unavailable.
checking whether to use python... /usr/local
checking for python2.6... no
checking for python2.5... no
checking for python2.4... no
configure: error: no usable python found at /usr/local
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory `/usr/local/build/gdb-7.1/build-python2'
make: *** [all] Error 2

BTW, I think specifying default directories might not be a good idea
and it leads to a gcc warning:

configure:9525: gcc -o conftest -g -O2 -I/usr/local/include
conftest.c -lncurses -lz -lm -L/usr/local/lib -lpython2.5 >&5
cc1: warning: changing search order for system directory "/usr/local/include"
cc1: warning: as it has already been specified as a non-system directory

but anyway, linking fails with exactly the same problem:

/usr/local/build/Python-2.5.5/build/../Python/dynload_shlib.c:130:
undefined reference to `dlopen'
(also dlsym, dlerror)
/usr/local/lib/libpython2.5.a(thread.o): In function `PyThread_acquire_lock':
/usr/local/build/Python-2.5.5/build/../Python/thread_pthread.h:334:
undefined reference to `sem_wait'
(also sem_trywait, pthread_attr_setstacksize, pthread_create...)
/usr/local/lib/libpython2.5.a(posixmodule.o): In function `posix_openpty':
/usr/local/build/Python-2.5.5/build/../Modules/posixmodule.c:3519:
undefined reference to `openpty'
(also forkpty)

as before, it seems to need -ldl and -lpthread, which is missing
on command line and cannot be added via `LIBS="-ldl -lpthread"'.

> With CVS gdb, you instead point to the 'python' executable.
>
> Steffen> Now I got resolved symbols from libdl (dl_open and
> Steffen> friends) and even from libpthread (sem_init, pthread_create...).
>
> This sounds familiar... I think it was fixed after 7.1.

i.e. in CVS gdb?

> It is more ordinary to install and use libpython.so, not the .a.
> If you want to go this route it may be simpler to try CVS gdb (though I
> am not sure -- I'm always just using my distro's python).

ok, I'll try python --enable-shared... I guess it has a bigger
chance to succeed?

Steffen