From patchwork Sun Aug 19 17:23:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 144536 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3089710ljj; Sun, 19 Aug 2018 10:24:22 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwC5cyvBqkMm66vVNa2gepQm+D6UrRaY92bSQahghQ0P7dmdAPwqU44fXIkxAd/zQ1BJFrm X-Received: by 2002:a63:fb57:: with SMTP id w23-v6mr40189532pgj.441.1534699462721; Sun, 19 Aug 2018 10:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534699462; cv=none; d=google.com; s=arc-20160816; b=0oy+B5Tg3O9aG/rPyzyFcuRUY5XPDJsBb1mCMsnkRyAXrVwWov4go1hWL2lkxjYyZy YczybyVS2eXkqXJwq4JpOmGeODyZgmPiU7yaNaEqjD8NxH2CTQw84k7UEL91d1HifqZS kFOPigVGdH2LqEFEY15znHS7fftQNgZJ7FwFzCalx6QSvQBTy+feji/LQaPE8h5azUAf CO9BZZYCUXKle0IDlHXcYAUjJCp+xmWmh2zuvt5IWlsmgl2yjLJpIbW4wEi8MuFKzt8d NIq3QGFWQOeokS6StqqhwC49fgOmV+O1NriaPwCAQ7KE9bxH7EBnnero4txI0jb0kdvG jckw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=bcEW1NwhF/uD7puW4b7bVyq8/t7adnnFOBKLhQPaKA4=; b=jv3bwEqGOhrKRfPAZWAJ6a3ccCWBtUvZHJB620bcMDJl0DNizjJjYPtAPg9xd3qYrf e2R4BDE1Hg/PdMASzkkTNRXhqR/wU+cpOOKKexUJ/GXKrah8jIfBmaluMPUy/lCJgPkS H2kMk1lTmAwLHLmIcMsMAcWlZwjF0EPr7W8seO19QNk6ZtgwGgSPemIMZX9/viD49bZw CoLRh0uphn8NbcCmPPUBbaq0s6oIa3ex2E+BJqhsc81YQwWV4YEkahfDpBHskNX9cfdb z1srdxvmbIb80/rMSIVvWIugs+y6f3iAg6J4gUNWNL7Z5KMly/0obIKRDtPew80y1Mad BNFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=E0oxc4mb; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id q65-v6si7948312pfb.9.2018.08.19.10.24.22; Sun, 19 Aug 2018 10:24:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=E0oxc4mb; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 9751879258; Sun, 19 Aug 2018 17:24:01 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by mail.openembedded.org (Postfix) with ESMTP id 3B07679224 for ; Sun, 19 Aug 2018 17:23:53 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id j8-v6so5608101pff.6 for ; Sun, 19 Aug 2018 10:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vKibzbLpaZgpSlBh2YkxbU8QkteV/aZDIQJG2yQS/Tk=; b=E0oxc4mblfzz1yTLpW35f7sq76sX+LF7QlbyYY7p0htgTx+FJeMeIN2BeAAyqSH5Ow b1Rqz5vcaNJtN93Fn5nbLfHu80ltq8PgZNNw9zQt9iJ908c6szWL8McawCeBCwY5gYqw 2/u19edkHTzWXeylxwdqdgJ6FhXTyX+KoWhHvENP9643TveY5v4EEVidKcZndhPwHr8h ipoKIIGq8I9gwuWy/chaXdAaabXoGIoXUw6mHkBLhPWK36h+bQvPvM6HQ+1zsCBKqXW3 Y53N3IV1aaTPNbxgnxQC7blgjqfVbqqh6iHjVkG7a/jWeeNDf7IzLJU40w6QI751kg/M IbuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vKibzbLpaZgpSlBh2YkxbU8QkteV/aZDIQJG2yQS/Tk=; b=egciHUjjxaii8nx1/lapydzilitbSCHyxbyZJTNUtVs+sRP7nEmY8GWatdutJw32hN DhTLc5CP+6iY8QUdUAicKd/uMaBqHPteq6AZLNZwSDr8e7AZ5fAKNUzpdKQdDpx8Ik7m 16vyhZhFs6CRnfQaVxdRn4ToTbMEXraG1V64V7Cbnjo1y8UqNgrALMH3fb7CX7XxN9uz FxsWEOe0i+v1/03mQTCMKm/wiG9pYjBwkAJLrOont9qn/wvu0Q9poAOaxMHySTYPBNk+ VD7j3u3X4N6cGCqY4LZYnxheyvBWgYSdjEImXBIZkDJamps06pleckf9Cqj2ryqCB7/t T9MA== X-Gm-Message-State: AOUpUlH+bz7/ygR9gc7IFff3xtcKG9TBv17VgkkRhaG/Q/DpSZEPDDcC 4TpRtMbKJP3nawXHduW0DKXmq3NU X-Received: by 2002:a65:614a:: with SMTP id o10-v6mr39591210pgv.387.1534699433916; Sun, 19 Aug 2018 10:23:53 -0700 (PDT) Received: from localhost.localdomain ([2601:646:877f:9499::4add]) by smtp.gmail.com with ESMTPSA id x1-v6sm8293466pgr.59.2018.08.19.10.23.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Aug 2018 10:23:53 -0700 (PDT) From: Khem Raj To: openembedded-core@lists.openembedded.org Date: Sun, 19 Aug 2018 10:23:37 -0700 Message-Id: <5745ccc3cd9a11770ef83f8360bee5672c6962f7.1534699224.git.raj.khem@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [OE-core] [PATCH 5/9] llvm: Use YOCTO_ALTERNATE_MULTILIB_NAME environment variable in llvm-config X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org llvm-config is a tool on similar veins as pkg-config but provides a lot more information and packages which use llvm e.g. mesa use this tool to poke for llvm related informaiton e.g. version, libpath, includepaths to name a few, this has few challanges in cross build environments where llvm-config is supposed to be build for buildhost but provide information about target llvm which is addressed by building native llvm-config along with target llvm build, but this is frowned upon by OE build system since it detects that host paths are being used so we have to build it as part of llvm-native but then it means install paths for llvm and llvm-native are different and wrong paths get reported when llvm-config is used. This is solved by providing YOCTO_ALTERNATE_EXE_PATH variable to let llvm-config use that path instead of self-relative path to report back Second problem is when building multi-lib packages base_libdir is different for target packages but native llvm-config does not know about it so it reports non-multilibbed paths as libdir and packages can not find llvm in sysroot. This is fixed by adding another environment variable YOCTO_ALTERNATE_MULTILIB_NAME which can be set from recipes to set proper multilib path Signed-off-by: Khem Raj --- ...-llvm-allow-env-override-of-exe-path.patch | 47 ++++++++++++++++--- 1 file changed, 40 insertions(+), 7 deletions(-) -- 2.18.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch index 21d2f81b58..6a9283323c 100644 --- a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch +++ b/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch @@ -1,4 +1,4 @@ -From 2f8ea767afdaa440c6368040630e1b3ea6a0977a Mon Sep 17 00:00:00 2001 +From aeccf16eaccdd80e4d5ecaa51673ce4b2bac1130 Mon Sep 17 00:00:00 2001 From: Martin Kelly Date: Fri, 19 May 2017 00:22:57 -0700 Subject: [PATCH 2/2] llvm: allow env override of exe path @@ -8,16 +8,19 @@ return the libraries, include directories, etc. from inside the sysroot rather than from the native sysroot. Thus provide an env override for calling llvm-config from a target sysroot. +To let it work in multilib environment, we need to provide a knob to supply +multilib dirname as well + +Upstream-Status: Inappropriate [OE-Specific] + Signed-off-by: Martin Kelly Signed-off-by: Khem Raj --- -Upstream-Status: Pending - - tools/llvm-config/llvm-config.cpp | 7 +++++++ - 1 file changed, 7 insertions(+) + tools/llvm-config/llvm-config.cpp | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp -index 08b096afb05..d8d7742744e 100644 +index 08b096afb05..360cc5abf4e 100644 --- a/tools/llvm-config/llvm-config.cpp +++ b/tools/llvm-config/llvm-config.cpp @@ -225,6 +225,13 @@ Typical components:\n\ @@ -34,6 +37,36 @@ index 08b096afb05..d8d7742744e 100644 // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. void *P = (void *)(intptr_t)GetExecutablePath; +@@ -306,12 +313,20 @@ int main(int argc, char **argv) { + std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir, + ActiveCMakeDir; + std::string ActiveIncludeOption; ++ // Hack for Yocto: we need to override the multilib path when we are using ++ // llvm-config from within a target sysroot. ++ std::string Multilibdir = std::getenv("YOCTO_ALTERNATE_MULTILIB_NAME"); ++ if (Multilibdir.empty()) { ++ Multilibdir = "/lib" LLVM_LIBDIR_SUFFIX; ++ } ++ + if (IsInDevelopmentTree) { + ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include"; + ActivePrefix = CurrentExecPrefix; + + // CMake organizes the products differently than a normal prefix style + // layout. ++ + switch (DevelopmentTreeLayout) { + case CMakeStyle: + ActiveBinDir = ActiveObjRoot + "/bin"; +@@ -336,7 +351,7 @@ int main(int argc, char **argv) { + SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR)); + sys::fs::make_absolute(ActivePrefix, path); + ActiveBinDir = path.str(); +- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; ++ ActiveLibDir = ActivePrefix + Multilibdir; + ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } -- -2.16.1 +2.18.0