bad library order returned by gdb/python/

David Taylor
Wed May 29 16:54:00 GMT 2013

When linking, a library should be listed before the libraries that it
depends upon.  With shared libraries, this is less important, but still
a good idea.  With static libraries it matters.

The file gdb/python/ in the gdb 7.6 release lists the
python library *AFTER* the libraries that it depends upon.  This causes
linkage errors during the configure phase of the build -- causing GDB to
not use python.

Here's a trivial unified diff patch.

Index: gdb/python/
RCS file: /home/cvsroot/GDB/gdb/python/,v
retrieving revision
diff -u -r1.1.1.1
--- gdb/python/	9 May 2013 19:00:17 -0000
+++ gdb/python/	29 May 2013 16:46:38 -0000
@@ -59,11 +59,11 @@
     elif opt in ('--libs', '--ldflags'):
         libs = []
+        libs.append('-lpython'+pyver + abiflags)
         if getvar('LIBS') is not None:
         if getvar('SYSLIBS') is not None:
-        libs.append('-lpython'+pyver + abiflags)
         # add the prefix/lib/pythonX.Y/config dir, but only if there is no
         # shared library in prefix/lib/.
         if opt == '--ldflags':

More information about the Gdb mailing list