build: fixed a link order problem
authorAndrew Tridgell <tridge@samba.org>
Thu, 2 Feb 2012 01:36:44 +0000 (12:36 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 2 Feb 2012 05:54:42 +0000 (06:54 +0100)
this fixes a problem found by obnox where the -L path for CUPS was put
before the path to internal libraries. The install path for CUPS
happened to be the same as for a old system libtevent, which meant we
linked against the old tevent instead of the correct one from our
private library paths.

The problem was that we were adding the -L paths directly to the
ldflags. The waf core code (in ccroot.py) only adds more paths if they
are not there already. So by adding it in ldflags it was not added at
the end of the list. The fix is just to not do the -L processing in
wafsamba and let the waf core do it in the right order

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Feb  2 06:54:42 CET 2012 on sn-devel-104

buildtools/wafsamba/samba_autoconf.py

index 1ea818ef30985b6896a5708c4667ec5f406cab29..6ed719a80adde3c2984742ac94943a56b0d1e751 100644 (file)
@@ -471,7 +471,9 @@ def library_flags(self, libs):
         inc_path = getattr(self.env, 'CPPPATH_%s' % lib.upper(), [])
         lib_path = getattr(self.env, 'LIBPATH_%s' % lib.upper(), [])
         ccflags.extend(['-I%s' % i for i in inc_path])
-        ldflags.extend(['-L%s' % l for l in lib_path])
+        # note that we do not add the -L in here, as that is added by the waf
+        # core. Adding it here would just change the order that it is put on the link line
+        # which can cause system paths to be added before internal libraries
         extra_ccflags = TO_LIST(getattr(self.env, 'CCFLAGS_%s' % lib.upper(), []))
         extra_ldflags = TO_LIST(getattr(self.env, 'LDFLAGS_%s' % lib.upper(), []))
         ccflags.extend(extra_ccflags)