From patchwork Thu Sep 5 00:22:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 173104 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp33143ilq; Wed, 4 Sep 2019 17:22:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwe1EI1iNnG+LORnA0kNU+slOyXJHNS1Un1Lq9oFgKJKJ7boSgHa5TDxEW6KVTcmvff7hsP X-Received: by 2002:a62:b416:: with SMTP id h22mr464304pfn.180.1567642950051; Wed, 04 Sep 2019 17:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567642950; cv=none; d=google.com; s=arc-20160816; b=n3AzGnCidrJXThKXWrotXyaWm2pTsbjRaLeZJ96m9Jov6kXq4gF5z7lt24s8X2e1kF btkOiQ5rBAYllYlGHrasOmPT+mSKxYJuh+9Biz2lLFSq9X9A4QbKIHdiiv0Q8zcCRF7f WTitRL/rKd4be8OuNFQSDMq+38Xfc1RFyKe1HMj8PnEqCKAiqJ8DuS1K5T31QzutLseZ XQxS5BgJRNwO+YvkTfE2KqvwFOiRGYh3L1elWBq49xTGzi4G+4gd+1r1NcnVErlkK8oQ 6FnL+/LR9D+iIBvF8tQly6VBXyaGED4pUWOun6wwd3l2IK7ABTqaaaWlXx/SY5dI99xe azvw== 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=Uy5TauPHMb4eGUtTL+SFWVqlE59NEXu8tRlSGkjC2ec=; b=el1p/NVl5AKyJzaQ2MqHSVR/rpJ/SGdYb22Lt8wXDhd8v0GUKEGw8kUlFxZIcgc40z 78StUHf/07wg5wgQv08s5h8u0g6e0wFCNTp3+hCJu0+SygNuMwAUJnpoe/qNJGhStP8i KsewGb1Eez9fYO00uqQPlpIJ98M+srXj/QWqzO2prNjSa+3TEqgpJQ0liFas/D9eurxU 1BuDLA0inHdOnYuGI6S7GerljDorEgD52e7UximwR7Freeq9HjxnQGlu4ZCg7/IgTKg8 3DPmTOb8JKi5qLMFwJKMRRe/EfUU0xbI0MhI8ADesBgHGnyk5rgtPTmQzHoSVfpq7GAE /yew== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=DZKAgdlL; 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 j63si223439pgd.493.2019.09.04.17.22.29; Wed, 04 Sep 2019 17:22:30 -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=DZKAgdlL; 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 960A57C79F; Thu, 5 Sep 2019 00:22:23 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mail.openembedded.org (Postfix) with ESMTP id 65C587C79F for ; Thu, 5 Sep 2019 00:22:22 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id k1so367294pls.11 for ; Wed, 04 Sep 2019 17:22:23 -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=vPOTX2yyj8B+mYOwGKNuQ+B0MFuL4pvPsYsqKq4q0JA=; b=DZKAgdlLAm+H8JixRdcIapBN27kKjUYkgGlDIqVwVoDFdyolr1gBfUfoVpZhQedVP5 tLfOra3UTMifASLQfHQeE/3oQLFGU/sRYGvvsQ0LRL7Q6UEsc22lVXtYBOCFLArYsoAw skoTrm532LigGLV4jzmWVLea/vGP05tJhyCxSRNsAtTZ6bcSM4yoSYPXKoxcPh/AtppV jq92U4/8owrncqZb7cqkKdI0kh6JJ0AqzpFDZwXTpB6BCKYpa/qlDslSQ8txvkuS6Umv E2Y33hxyqV4u41fBTCKiOl3rV9zwAvixUzZp76aYP6Kxi4pE8axe5iNFpkRGrLwBMP7w zsFg== 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=vPOTX2yyj8B+mYOwGKNuQ+B0MFuL4pvPsYsqKq4q0JA=; b=WXqSa/lgSq7j3JZLDHBxHvGuKaQCpfylZpEP1MG4AXH53hWKJI41cKrYT+dv2vL/ve tYiM4Ocpklv+JZefeHwVG0mF7JCJdAfa7mIPun/c9PzNfM7PigwGZYbzjVxUobQlcIPH 78Wbew8rVM12fZxYlsCGbRHgfIVmxdl4SgBbsCVb9G4B2O0S90ZSKMbHKOlfJP9Su779 ErL1vCf0+Cy5ORVwZWH5j00Um/+83m90zGx2AjGif2/21RxaiGLsqbWMqke50Bg3b1zQ y3mZD9hkbXvMgx7uyXNDxQHQhEjBwI/Xt93k/edz2tQPlr2Gxgt6/h4/PJ3E98QqMyro xRiA== X-Gm-Message-State: APjAAAWdcJg6l99CthaUvhT6NgEbd25Fw/gdGusTskP4azC9cLr/Rzh/ nTPAl1ziTckHf6Z1Fd/u2bkk28W7ABU= X-Received: by 2002:a17:902:5ac3:: with SMTP id g3mr503685plm.25.1567642942694; Wed, 04 Sep 2019 17:22:22 -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 q71sm172830pjb.26.2019.09.04.17.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 17:22:22 -0700 (PDT) From: Khem Raj To: openembedded-core@lists.openembedded.org Date: Wed, 4 Sep 2019 17:22:11 -0700 Message-Id: <20190905002211.30477-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [OE-core] [PATCH V3] 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 v3: Point to .so directly 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 diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass index a3acaf61bb..d98fb4c758 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}/lib${PYTHON_DIR}${PYTHON_ABI}.so" +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}" + 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..0e9019d1e2 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}/lib${PYTHON_DIR}${PYTHON_ABI}.so" +export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}" + # suppress host user's site-packages dirs. export PYTHONNOUSERSITE = "1"