From 4040bc13f65e6b106d07748f7602f95eebc4d6b0 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 2 Oct 2019 17:49:16 -0700 Subject: [PATCH] getdeps: fixup-dyn-deps: use patchelf from our manifest on linux Summary: On linux we use `patchelf` to manipulate dynamic deps but it isn't guaranteed to be installed everywhere. We have a manifest file that describes how to build it, but so far nothing has told getdeps that it should build it. This diff updates the ELF dep munging code to literally run `getdeps.py build patchelf` and then use that patchelf binary to manipulate the object files. Refs: https://github.com/facebook/watchman/pull/750 Reviewed By: pkaush Differential Revision: D17705351 Pulled By: wez fbshipit-source-id: 358ef239edb389fbd51fa023ff553963aa80b6c7 --- build/fbcode_builder/getdeps/dyndeps.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/fbcode_builder/getdeps/dyndeps.py b/build/fbcode_builder/getdeps/dyndeps.py index d869d0c2a..4fa0db676 100644 --- a/build/fbcode_builder/getdeps/dyndeps.py +++ b/build/fbcode_builder/getdeps/dyndeps.py @@ -201,7 +201,16 @@ class WinDeps(DepBase): class ElfDeps(DepBase): def __init__(self, buildopts, install_dirs): super(ElfDeps, self).__init__(buildopts, install_dirs) - self.patchelf = path_search(self.env, "patchelf") + + # We need patchelf to rewrite deps, so ensure that it is built... + subprocess.check_call([sys.executable, sys.argv[0], "build", "patchelf"]) + # ... and that we know where it lives + self.patchelf = os.path.join( + subprocess.check_output( + [sys.executable, sys.argv[0], "show-inst-dir", "patchelf"] + ).strip(), + "bin/patchelf", + ) def list_dynamic_deps(self, objfile): out = (