From patchwork Wed Sep 4 18:49:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 172961 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp308072ilq; Wed, 4 Sep 2019 11:49:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQ7SV5LjFFE+/syhjQtFi/MOSamWr4iFYMl3YyiCVcnIVOzgFMoueliWBHYNXbop4z2SVZ X-Received: by 2002:a65:6546:: with SMTP id a6mr37696811pgw.220.1567622980081; Wed, 04 Sep 2019 11:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567622980; cv=none; d=google.com; s=arc-20160816; b=E4FgJaXrFPncDAft8QXNc0SHbxPk6udEmlYB9tG+bQo1cf6hM7HCpCLUdfh04Geu60 SilRvDkdGcxIer5/q4B0weOYCIqv0siIqdiJVBPyZCcsceqMVN/PRcd/nYE2aqjM/fJw RPr20ukMbJuya4TQ2CGFqEDwRkhPVjVSE2NQ61hjYwgA6xcJWqxY4HKa4ySagfu73+ek iZaFlnz552AGJnQpHBfy/wV3KVzMnpn99NovYWULib/hY9xfo6IWVphKIxyL7rGtI1ai F4Xipu3FlbcNe/rzS4PqGCaXbrcjPI0pQzjeHAXGSNbarEyIwkssW9n2kZHgWKFuL3Aq AUeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:delivered-to; bh=j1TRJYC4tvUlVFCfSJR9LXW0QwvnM7Q9uLgMewDn6pU=; b=tgQ9kTDOp9pNcFsLzhD3F+dO8XeuI3N32jaQA8Zu1GXYTdDsuJP7r6DGlv5CVc/HLM Je/VAnOyBXehZ+XP2HkYeEcxfJ6PZTE2akcwp9u6IqKv+NMIlVOcPg1V9VZ6O2acavPI jhBjcd5Lv0bUSP6zkTuON8fPaS6VYnFV9TMgCdltw+jBpJRwpir4hBGI0B1dyk6hTtVB lDZp8nULfsqmIZmr2YpvA8cZpp1dP2Ek/rbjWzN3zzKzBA7icGxBXSZi0ChuWSv2tNfn 4nqSqw3+IL8JKiLsIxGZeJh9he88QuHp7LRnjevnSM//xfEasiO2hpLYGzkcifWFICB4 d2Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=UvzuYxfK; 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 s12si18458895plp.290.2019.09.04.11.49.39; Wed, 04 Sep 2019 11:49:40 -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=UvzuYxfK; 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 ec2-34-214-78-129.us-west-2.compute.amazonaws.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 0B70F7F26C; Wed, 4 Sep 2019 18:49:38 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by mail.openembedded.org (Postfix) with ESMTP id 12DA67F261 for ; Wed, 4 Sep 2019 18:49:35 +0000 (UTC) Received: by mail-pg1-f181.google.com with SMTP id n4so11728061pgv.2 for ; Wed, 04 Sep 2019 11:49:37 -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:mime-version :content-transfer-encoding; bh=vMdwW2u4jhBF4rqYJDoOwyQ/NfCfyVA4/pg4S0RDz8U=; b=UvzuYxfKhMMLTEz0F4hqKV6EQjXCqWVxmatigG4tKcI+Qv9XmKBylcZ7aWZkmOoFHA AurMJgCrxhh7KI8IQ7Ja0MuzP5/jL3kjBgSE/x+ST+4I8hSq+/CuHbrYl0A7Sk3iVfI/ KumQECYvhtdYzyb4GjsOzTQkYU2SYhXcnCO1Cbv7XYOJdWA96NHwV2P+sETXp1hKfHM8 //wLqDSPZa8BQ8az7+LoLFaMp0gwNZ5PSFUEyp0MOAw0VyLAHAwtOJTGc8e/2sG5vuy0 QkRP44V0au0cajf4LPBMBiIpTKfQrblXXbsJcfVmfN1aWgmrL9pPqma2EjXpOpj3FvUt WjBw== 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:mime-version :content-transfer-encoding; bh=vMdwW2u4jhBF4rqYJDoOwyQ/NfCfyVA4/pg4S0RDz8U=; b=j4rPXDQXF8zZKJnCp1ZtuM0IaNz9Yj6hOyTNtqNCKatrHKEADe/r/nhtZ++swsOGzC LOfxEtq8qnfrYrMwvKqHaDi12S0ouUC9Efg1aYb+qITWOAX1AXgAyANZyYUuItiwB26i 61DV8kYD3j5uTTaC2Pnju7V4WxLXV/aE219ypz6XufaT4jhqm0te1CXvDzk3AyENKyr1 RNQi18EgfHUU3zaFHitZ3T4Z656c1y5dcSwpDh/hjSUSYh/1RMwS0wYpKHyk1NqsHvXO ovzrZstV/FZRHDPdLQN0d2C6V1cLpUQnoCdbL7k0Yzw9yVQM6bAgrE6oTf4BJObUjelf Nzwg== X-Gm-Message-State: APjAAAW8u5qOOfUlnveRg6WyOIyrOByTHYenZ0qIZe1d2/nlWIxxMwOl Yk/JBujuqxjzWCGoKpRmZRvsPUMMSlw= X-Received: by 2002:a63:7d05:: with SMTP id y5mr36689687pgc.425.1567622976382; Wed, 04 Sep 2019 11:49:36 -0700 (PDT) Received: from apollo.hsd1.ca.comcast.net (c-73-71-176-3.hsd1.ca.comcast.net. [73.71.176.3]) by smtp.gmail.com with ESMTPSA id 196sm13947695pfz.99.2019.09.04.11.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 11:49:35 -0700 (PDT) From: Khem Raj To: openembedded-core@lists.openembedded.org Date: Wed, 4 Sep 2019 11:49:28 -0700 Message-Id: <20190904184928.8414-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [OE-core] [PATCH V2] python3native, pythonnative: export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR 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: , Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org packages can use find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) while we control PYTHON pointing to native py3 the libs and include directories will then point to build host version, which can result in unexpected combination and if we are lucky we get errors if its quite different e.g. py2 libs/includes and py3 executable This variable can be then used to export PYTHON_LIBRARY and PYTHON_INCLUDE_DIR so that above find_packages can work correctly see [1] for how it happens in cmake LLDB uses it see [2] [1] https://github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake [2] https://github.com/llvm/llvm-project/blob/master/lldb/cmake/modules/LLDBConfig.cmake#L226 Signed-off-by: Khem Raj --- v2: Use PYTHON_DIR variable meta/classes/python3native.bbclass | 8 ++++++++ meta/classes/pythonnative.bbclass | 8 ++++++++ 2 files changed, 16 insertions(+) -- 2.23.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core Signed-off-by: Khem Raj <raj.khem@gmail.com>
diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass index a3acaf61bb..768302488b 100644 --- a/meta/classes/python3native.bbclass +++ b/meta/classes/python3native.bbclass @@ -9,6 +9,14 @@ DEPENDS_append = " python3-native " export STAGING_INCDIR export STAGING_LIBDIR +# Packages can use +# find_package(PythonInterp REQUIRED) +# find_package(PythonLibs REQUIRED) +# which ends up using libs/includes from build host +# Therefore pre-empt that effort +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" + export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" # suppress host user's site-packages dirs. diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass index ae6600cd15..604423b80e 100644 --- a/meta/classes/pythonnative.bbclass +++ b/meta/classes/pythonnative.bbclass @@ -12,6 +12,14 @@ DEPENDS_append = " python-native " export STAGING_INCDIR export STAGING_LIBDIR +# Packages can use +# find_package(PythonInterp REQUIRED) +# find_package(PythonLibs REQUIRED) +# which ends up using libs/includes from build host +# Therefore pre-empt that effort +export PYTHON_LIBRARY="${STAGING_LIBDIR}/${PYTHON_DIR}" +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}" + # suppress host user's site-packages dirs. export PYTHONNOUSERSITE = "1"