bad library order returned by gdb/python/python-config.py

David Taylor <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <27415.1369846439@usendtaylorx2l>
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/python-config.py 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/python-config.py
===================================================================
RCS file: /home/cvsroot/GDB/gdb/python/python-config.py,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 python-config.py
--- gdb/python/python-config.py	9 May 2013 19:00:17 -0000	1.1.1.1
+++ gdb/python/python-config.py	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:
             libs.extend(getvar('LIBS').split())
         if getvar('SYSLIBS') is not None:
             libs.extend(getvar('SYSLIBS').split())
-        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':
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.