Patch Detail
Show a patch.
GET /api/1.1/patches/3173/?format=api
{ "id": 3173, "url": "https://patchwork.libcamera.org/api/1.1/patches/3173/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3173/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200318152427.13126-4-kgupta@es.iitr.ac.in>", "date": "2020-03-18T15:24:25", "name": "[libcamera-devel,v4,3/5] libcamera: utils: Move libcamera build path lookup to utis", "commit_ref": "df493769a0d71c09898171c47438fc94bdc976b3", "pull_url": null, "state": "accepted", "archived": false, "hash": "404bfaff2bd6f2c2e2a1c6a87076c2cc3762496c", "submitter": { "id": 39, "url": "https://patchwork.libcamera.org/api/1.1/people/39/?format=api", "name": "Kaaira Gupta", "email": "kgupta@es.iitr.ac.in" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3173/mbox/", "series": [ { "id": 733, "url": "https://patchwork.libcamera.org/api/1.1/series/733/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=733", "date": "2020-03-18T15:24:22", "name": "libcamera: determine IPA_PROXY_PATH at runtime", "version": 4, "mbox": "https://patchwork.libcamera.org/series/733/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3173/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3173/checks/", "tags": {}, "headers": { "Return-Path": "<kgupta@es.iitr.ac.in>", "Received": [ "from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com\n\t[IPv6:2607:f8b0:4864:20::1035])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 76C6260418\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Mar 2020 16:25:54 +0100 (CET)", "by mail-pj1-x1035.google.com with SMTP id np9so1478178pjb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Mar 2020 08:25:54 -0700 (PDT)", "from kaaira-HP-Pavilion-Notebook ([103.113.213.153])\n\tby smtp.gmail.com with ESMTPSA id\n\th95sm2815201pjb.46.2020.03.18.08.25.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 18 Mar 2020 08:25:52 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=u86HCsBqr7w/2SZeUAv8KIRZ2eJWE3vQOxp62VxrhBE=;\n\tb=I8MucxoiNDV5yeTbLDaENx+NKBQPh4+Lm7WvTnzMpvhAJdXFJv7U3RFjwyJDxNwcUV\n\tC2SJFQHjo4uaA6foJXGFnh4elM94ZeKt3xdt4nIhoFZ5RHRmlNSh3/prj+e2uuNZ5/eD\n\tyY4Gs+YsYUX6bLXkMol33kPepCp+ohO5ZRmHY/ptpObXO6FpWBOLw0gFEIRLH+8tbLxD\n\tBXM08CaTasJhPdY3YKv/MuOzRBsWZ26QY41+QoVYmoKYQnF6fQnvfmHsfl6i3MCVDKkD\n\tjnzvmksm/RqRDsjLENWhBQQEVK0NRoT8wbCax+iNanZXU0fzX8lwSuPQB8jVSfjpSDko\n\t6S3g==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=u86HCsBqr7w/2SZeUAv8KIRZ2eJWE3vQOxp62VxrhBE=;\n\tb=hpv0Yy4hnQoIxHgtsm6nuL3Lt+ZDK8m68oOWadZizEEpRXKq7cc/SVTIX8UKFym12E\n\txWnZSzEXNQIzMfSDDkCMYvGNaRKnVYhwKqL7WGyPk0b0wcmqHUYwo4fHcOMgcj0DVWRy\n\tlqoL69OaN8w+xCLT0BdC8rQ8yTYwQhT/Rm4nFEtdYwBWQ6ISbrb0y3nZhuaCilEZxfZh\n\tvRQ30CfR4Wxp3noSqVTnse1B1IqpyA4Sc97k+Rwj2tsb7hGsFytWDY7xB0FP4A1/KFH5\n\t3km7WDMaHBf9/lEN47/mEay9h26p0LrelLn3QlyeJiShv5VE8I+a7lND9rQ6GSnft0CA\n\trTcA==", "X-Gm-Message-State": "ANhLgQ1VjeKUAbWMYC1xKnPndJNN6oSFKk1LdCSxvqq0kAH2B1dXGJ4O\n\tLyoyLcsazVFm0yw0Ivs4O7/2mQ==", "X-Google-Smtp-Source": "ADFU+vt/ok0w1co6rWn3pnLTYuKuDq+HSg1QVAPZ70F6QXaKY26WeTfviOJBLGomv73xc6Gy5yoaOA==", "X-Received": "by 2002:a17:90a:bd96:: with SMTP id\n\tz22mr5085942pjr.172.1584545152805; \n\tWed, 18 Mar 2020 08:25:52 -0700 (PDT)", "From": "Kaaira Gupta <kgupta@es.iitr.ac.in>", "To": "Vaishali Thakkar <vthakkar@vaishalithakkar.in>,\n\tHelen Koike <helen.koike@collabora.com>,\n\tkieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org", "Cc": "Kaaira Gupta <kgupta@es.iitr.ac.in>", "Date": "Wed, 18 Mar 2020 20:54:25 +0530", "Message-Id": "<20200318152427.13126-4-kgupta@es.iitr.ac.in>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20200318152427.13126-1-kgupta@es.iitr.ac.in>", "References": "<20200318152427.13126-1-kgupta@es.iitr.ac.in>", "Subject": "[libcamera-devel] [PATCH LIBCAMERA v4 3/5] libcamera: utils: Move\n\tlibcamera build path lookup to utis", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "X-List-Received-Date": "Wed, 18 Mar 2020 15:25:54 -0000" }, "content": "The IPA proxy manager will need to find the libcamera build path exactly\nthe same way as the IPA module mnager. Move the isLibcameraInstalled()\nand libcameraPath() functions to utils to make them reusable.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\n src/libcamera/include/utils.h | 4 +++\n src/libcamera/ipa_manager.cpp | 36 ++-----------------------\n src/libcamera/utils.cpp | 49 +++++++++++++++++++++++++++++++++++\n 3 files changed, 55 insertions(+), 34 deletions(-)", "diff": "diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex 9405977..bc96e79 100644\n--- a/src/libcamera/include/utils.h\n+++ b/src/libcamera/include/utils.h\n@@ -143,6 +143,10 @@ private:\n \n details::StringSplitter split(const std::string &str, const std::string &delim);\n \n+bool isLibcameraInstalled();\n+\n+std::string libcameraPath();\n+\n } /* namespace utils */\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 238433d..0bd280c 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -9,9 +9,6 @@\n \n #include <algorithm>\n #include <dirent.h>\n-#include <dlfcn.h>\n-#include <elf.h>\n-#include <link.h>\n #include <string.h>\n #include <sys/types.h>\n \n@@ -27,35 +24,6 @@\n * \\brief Image Processing Algorithm module manager\n */\n \n-static bool isLibcameraInstalled()\n-{\n-\t/* musl doesn't declare _DYNAMIC in link.h, declare it manually. */\n-\textern ElfW(Dyn) _DYNAMIC[];\n-\n-\t/*\n-\t * DT_RUNPATH (DT_RPATH when the linker uses old dtags) is removed on\n-\t * install.\n-\t */\n-\tfor (const ElfW(Dyn) *dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) {\n-\t\tif (dyn->d_tag == DT_RUNPATH || dyn->d_tag == DT_RPATH)\n-\t\t\treturn false;\n-\t}\n-\n-\treturn true;\n-}\n-\n-static std::string libcameraPath()\n-{\n-\tDl_info info;\n-\n-\t/* Look up our own symbol. */\n-\tint ret = dladdr(reinterpret_cast<void *>(libcameraPath), &info);\n-\tif (ret == 0)\n-\t\treturn nullptr;\n-\n-\treturn info.dli_fname;\n-}\n-\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPAManager)\n@@ -151,8 +119,8 @@ IPAManager::IPAManager()\n \t * path for the IPA from that point. We need to recurse one level of\n \t * sub-directories to match the build tree.\n \t */\n-\tif (!isLibcameraInstalled()) {\n-\t\tstd::string ipaBuildPath = utils::dirname(libcameraPath()) + \"/../ipa\";\n+\tif (!utils::isLibcameraInstalled()) {\n+\t\tstd::string ipaBuildPath = utils::dirname(utils::libcameraPath()) + \"/../ipa\";\n \t\tconstexpr int maxDepth = 1;\n \n \t\tLOG(IPAManager, Info)\ndiff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\nindex f566e88..7e118fa 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -7,7 +7,10 @@\n \n #include \"utils.h\"\n \n+#include <dlfcn.h>\n+#include <elf.h>\n #include <iomanip>\n+#include <link.h>\n #include <sstream>\n #include <stdlib.h>\n #include <string.h>\n@@ -18,6 +21,9 @@\n * \\brief Miscellaneous utility functions\n */\n \n+/* musl doesn't declare _DYNAMIC in link.h, declare it manually. */\n+extern ElfW(Dyn) _DYNAMIC[];\n+\n namespace libcamera {\n \n namespace utils {\n@@ -310,6 +316,49 @@ details::StringSplitter split(const std::string &str, const std::string &delim)\n \treturn details::StringSplitter(str, delim);\n }\n \n+/**\n+ * \\brief Check if libcamera is installed or not\n+ *\n+ * Utilise the build_rpath dynamic tag which is stripped out by meson at\n+ * install time to determine at runtime if the library currently executing\n+ * has been installed or not.\n+ *\n+ * \\return True if libcamera is installed, false otherwise\n+ */\n+bool isLibcameraInstalled()\n+{\n+\t/*\n+\t * DT_RUNPATH (DT_RPATH when the linker uses old dtags) is removed on\n+\t * install.\n+\t */\n+\tfor (const ElfW(Dyn) *dyn = _DYNAMIC; dyn->d_tag != DT_NULL; ++dyn) {\n+\t\tif (dyn->d_tag == DT_RUNPATH || dyn->d_tag == DT_RPATH)\n+\t\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+/**\n+ * \\brief Identify the libcamera.so path\n+ *\n+ * This function locates the running libcamera.so and returns its full path,\n+ * including the file name.\n+ *\n+ * \\return A string stating the path\n+ */\n+std::string libcameraPath()\n+{\n+\tDl_info info;\n+\n+\t/* Look up our own symbol. */\n+\tint ret = dladdr(reinterpret_cast<void *>(libcameraPath), &info);\n+\tif (ret == 0)\n+\t\treturn nullptr;\n+\n+\treturn info.dli_fname;\n+}\n+\n } /* namespace utils */\n \n } /* namespace libcamera */\n", "prefixes": [ "libcamera-devel", "v4", "3/5" ] }