Set -rpath in all thirdparty libs for compat with gold

Make sure that thirdparty shared libs are built with a -rpath that
includes thirdparty/installed-deps* because the GNU gold linker
specifies RUNPATH by default, instead of RPATH. This is due to the fact
that at the time of this writing, gold defaults to --enable-new-dtags
while binutils ld defaults to --disable-new-dtags [1].

Unfortunately, glibc does not search an executable's RUNPATH for
transitive dependencies [2], like it does for RPATH. This results in
symbol not found errors for full builds done using gold as the linker
unless we apply this change.

This patch adds the installed-deps directory to the -rpath of thirdparty
shared objects so that the correct paths are set and the symbols are
resolved.

This issue was originally identified by Todd, and here is the text of
his email to the dev list:

a) I usually use gold rather than binutils ld as my linker. gold generates
RUNPATH instead of RPATH by default, which has the difference that RUNPATH
doesn't propagate transitively. In other words, even though
protoc-gen-insertions has installed-deps/lib in its RUNPATH, it doesn't use
_that_ RPATH when looking for dependencies of libglog.so, because
libglog.so has its own RUNPATH.

b) my libglog.so's RUNPATH doesn't have installed-deps/. It turns out that,
after I rebuilt my thirdparty from git completely clean, that one didn't
end up with it either. It only got installed-deps/ in its RUNPATH before
because I had an old 'libgflags.la' file lying around.

c) we no longer generate 'libgflags.la' from the gflags build
after 7a68e1f8baee04eaf259f7567ddc39e09a0f0938 which switched from using
autotools to cmake to build and install gflag. This means that we don't
generate the libtool control file 'libgflags.la' anymore, though my old one
got orphaned in the build directory.

[1] http://blog.tremily.us/posts/rpath/
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=13945

Change-Id: Ic50b3667f96cec73497248751e9afc785e3f7979
Reviewed-on: http://gerrit.cloudera.org:8080/2123
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins
(cherry picked from commit 2567ed0087ed6664a93ce1400e5f4f89c730cb14)
Reviewed-on: http://gerrit.cloudera.org:8080/2130
Reviewed-by: Jean-Daniel Cryans
Tested-by: Jean-Daniel Cryans
1 file changed