aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-26 07:10:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-26 07:10:04 +0200
commitcca1dff7339ed711ef541f908020f7d0aa1da649 (patch)
tree05fb93a1435ec8037a61dbf5fd68f6b8ce6e836c
parent18788475f3944a1fcfb9d0adaa0d51ae6b89ccbb (diff)
Add imported library rpaths before user-supplied0.3.0
This way we don't accidentally prefer old (installed) versions.
-rw-r--r--build2/cxx/link.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx
index a2f3a4f..fdaab55 100644
--- a/build2/cxx/link.cxx
+++ b/build2/cxx/link.cxx
@@ -879,16 +879,16 @@ namespace build2
args.push_back (soname2.c_str ());
}
- // Add rpaths. First the ones specified by the user so that they take
- // precedence.
+ // Add rpaths. We used to first add the ones specified by the user so
+ // that they take precedence. But that caused problems if we have old
+ // versions of the libraries sitting in the rpath location (e.g.,
+ // installed libraries). And if you think about this, it's probably
+ // correct to prefer libraries that we explicitly imported to the
+ // ones found via rpath.
//
- if (auto l = t["bin.rpath"])
- for (const dir_path& p: cast<dir_paths> (l))
- sargs.push_back ("-Wl,-rpath," + p.string ());
-
- // Then the paths of the shared libraries we are linking to. Unless
- // this is update for install, in which case we have to do something
- // different.
+ // Note also that if this is update for install, then we don't add
+ // rpath of the imported libraries (i.e., we assume the are also
+ // installed).
//
for (target* pt: t.prerequisite_targets)
{
@@ -908,6 +908,10 @@ namespace build2
append_rpath_link (sargs, *ls);
}
}
+
+ if (auto l = t["bin.rpath"])
+ for (const dir_path& p: cast<dir_paths> (l))
+ sargs.push_back ("-Wl,-rpath," + p.string ());
}
// All the options should now be in. Hash them and compare with the db.