From patchwork Sun Aug 4 22:05:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 1141860 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mind.be Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mind-be.20150623.gappssmtp.com header.i=@mind-be.20150623.gappssmtp.com header.b="17DpWopy"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 461w1k3sY1z9sDB for ; Mon, 5 Aug 2019 08:05:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2703C85AE0; Sun, 4 Aug 2019 22:05:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V6sE2zJCkfnA; Sun, 4 Aug 2019 22:05:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id F259784AB8; Sun, 4 Aug 2019 22:05:10 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 061061BF591 for ; Sun, 4 Aug 2019 22:05:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F3A278347D for ; Sun, 4 Aug 2019 22:05:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5rc9adZqdgQF for ; Sun, 4 Aug 2019 22:05:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by whitealder.osuosl.org (Postfix) with ESMTPS id DC84884AB8 for ; Sun, 4 Aug 2019 22:05:07 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id s49so42132023edb.1 for ; Sun, 04 Aug 2019 15:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind-be.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fmaq28i9Klzy/RMRfG4Fij0gqM7F+rHgW4gnNVuS7+0=; b=17DpWopybkPvR43Oez1BhIo5vP84gm3gmnKZkb4ABoKD9jmkR5pEKkcZINYdoymurO O2oDV7EJ5r7s9N/53azefDzTFgW57tXSiHh69Bg5ZnJQ0y6NsOPvybVE1PxbewNaBFKd SrM/CD+N2evkaaGk5oNuxcZbCWtRYnm6gAC38QnknBY3pfWlGn+X3zSVl/qXtn/A9Q3b 2nktALFYcnLQqp6Tjc/e95OA357cPSHzMBuZ4wgcjGN5j6B3FYSNZvHbxhdl0zk7Tv8j dWy05bJAIk+KuM0B/HoxU26Gq8d1uSPyej6nFoFZgdaLMXsRyAhXw9CqDQv1YVl+j/lZ jTEg== 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=fmaq28i9Klzy/RMRfG4Fij0gqM7F+rHgW4gnNVuS7+0=; b=mK6341fZj0FS8swuJyNFFe0DXOpqOplzv2mCJBlQCrnBsPklY5riVq1uu8bgNzZLQ3 6nEzysHCFTHVRRcVdkknk9/K7/PmGnX8dGj6QR2ojM2jJ7FdWlZ7S06yQcyCsidesGbK e+7p+3OOWxKo+0dbxihlda28LqQPy9cHduQ058qzxxc1iq4KaFVjVFEJPj19Na8WbQHp 2SjOLjnTMfxfMswje/SUNpKcgQKeqVY1ab/tYvCV8L3hGtNp3uQPNhEYrA8InnHYUAwu Mpj1GcfM5NlYHg7TF797gllwRZorEONeaV1g1ZyY3DMMYOuybLK6MsYuIfEryCjqtXjG Y37w== X-Gm-Message-State: APjAAAW9VFdNMZkC6q9xdduOwLnLTb7jE70Cu0fEz2/+qay9o76qCetf seel6hgGsS38URTAq4hcE9EEpIFqaBLWZg== X-Google-Smtp-Source: APXvYqxbnujKfY5vAwArCsM0JZYrdOlLeTdvPY27LVN/a8iBX3iGDskN0NnpXlFV9FrZxfmX7vFNAA== X-Received: by 2002:a50:b3d0:: with SMTP id t16mr130267650edd.158.1564956305789; Sun, 04 Aug 2019 15:05:05 -0700 (PDT) Received: from localhost.localdomain (94-225-144-99.access.telenet.be. [94.225.144.99]) by smtp.gmail.com with ESMTPSA id cb19sm14168438ejb.51.2019.08.04.15.05.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 15:05:04 -0700 (PDT) From: "Arnout Vandecappelle (Essensium/Mind)" To: buildroot@buildroot.org Date: Mon, 5 Aug 2019 00:05:03 +0200 Message-Id: <20190804220503.13534-1-arnout@mind.be> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] package/pkg-meson.mk: set Python sysconfigdata X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Le Bihan , James Hilliard , Peter Seiderer , "Yann E . MORIN" , Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" meson has support for Python dependencies, to e.g. build Python modules. It parses Python's sysconfig module to find the appropriate configuration variables. However, the sysconfig module is the one for the host, _not_ for the target. Therefore, wrong values may be set. Many of them get overridden anyway by the cross-compilation.conf. One particular one that is problematic is that it uses the python-XXX.pc pkg-config file for the host instead of the target, because it explicitly sets the PKG_CONFIG_LIBDIR found in sysconfig. Use the same trick as for python package: pass PYTHONPATH, PYTHONNOUSERSITE and _PYTHON_SYSCONFIGDATA_NAME in the environment to point to staging instead of host. This ensures the sysconfig from the target is used instead of the one from the host. An alternative would be to patch meson to not use the PKG_CONFIG_LIBDIR from sysconfig. However, it is likely that other problems will pop up at some point because of using the wrong sysconfig. Note that this approach will still break things when meson needs to build something for the host during a target build. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Cc: Adam Duskett Cc: Eric Le Bihan Cc: Peter Seiderer Cc: James Hilliard Cc: Yann E. MORIN Tested-by: Adam Duskett --- The setting of _PYTHON_SYSCONFIGDATA_NAME is different from the one in pkg-python.mk. I don't understand how that definition could work: for Python2, it is empty, so sysconfig tries to import a module with name "". So apparently the call paths used by meson and by setuptools/distutils are slightly different. --- package/pkg-meson.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 0b811d1cc0..3f875c08ce 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -81,6 +81,9 @@ define $(2)_CONFIGURE_CMDS -e "s%@HOST_DIR@%$$(HOST_DIR)%g" \ package/meson/cross-compilation.conf.in \ > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf + _PYTHON_SYSCONFIGDATA_NAME="$$(if $$(BR2_PACKAGE_PYTHON3),$$(PKG_PYTHON_SYSCONFIGDATA_NAME),_sysconfigdata)" \ + PYTHONPATH="$$(if $$(BR2_PACKAGE_PYTHON3),$$(PYTHON3_PATH),$$(PYTHON_PATH))" \ + PYTHONNOUSERSITE=1 \ PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \ --prefix=/usr \ --libdir=lib \