From patchwork Thu Nov 28 18:05:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1202256 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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=bootlin.com 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 47P5CP0XvQz9sPv for ; Fri, 29 Nov 2019 05:05:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 88BA387BAE; Thu, 28 Nov 2019 18:05:17 +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 PQtkLNYmvl7C; Thu, 28 Nov 2019 18:05:15 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B7E2087B61; Thu, 28 Nov 2019 18:05:15 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 82DD51BF30C for ; Thu, 28 Nov 2019 18:05:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7DBB420409 for ; Thu, 28 Nov 2019 18:05:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z+Fa-ZDDPZrQ for ; Thu, 28 Nov 2019 18:05:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by silver.osuosl.org (Postfix) with ESMTPS id 639DD203B9 for ; Thu, 28 Nov 2019 18:05:12 +0000 (UTC) Received: from localhost (192-245-144-85.ftth.glasoperator.nl [85.144.245.192]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id AC3D210000D; Thu, 28 Nov 2019 18:05:07 +0000 (UTC) From: Thomas Petazzoni To: Buildroot List Date: Thu, 28 Nov 2019 19:05:02 +0100 Message-Id: <20191128180502.230424-1-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] package/libselinux: fix build on old glibc with incompatible with LFS 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: Marcus Folkesson , Thomas Petazzoni , Fabrice Fontaine , Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" glibc versions prior to 2.23 have a implementation that is not compatible with large file support, causing build failures such as: In file included from selinux_restorecon.c:17:0: /home/naourr/work/instance-0/output-1/host/arm-buildroot-linux-gnueabi/sysroot/usr/include/fts.h:41:3: error: #error " cannot be used with -D_FILE_OFFSET_BITS==64" # error " cannot be used with -D_FILE_OFFSET_BITS==64" Prior to commit 3fce6f1c150dbe4be58d083008ca8dbe7257836e ("package/libselinux: fix the build with Python 3.8"), we were not passing PKG_PYTHON_DISTUTILS_ENV in the environment. But with 3fce6f1c150dbe4be58d083008ca8dbe7257836e, we are now passing the PKG_PYTHON_DISTUTILS_ENV variable, provided by pkg-python.mk, into the build environment. While this is part of fixing the build of libselinux with Python 3.8, it breaks the build because we are no longer filtering out the -D_FILE_OFFSET_BITS=64 option from CFLAGS. Indeed, while we do so at the beginning of libselinux.mk, it gets overridden later by the addition of $(PKG_PYTHON_DISTUTILS_ENV). To avoid this, we pass CFLAGS/LDFLAGS *after* $(PKG_PYTHON_DISTUTILS_ENV) has been added. In practice, the CFLAGS/LDFLAGS passed by $(PKG_PYTHON_DISTUTILS_ENV) are just $(TARGET_CFLAGS) and $(TARGET_LDFLAGS), so we are not missing anything specific. Fixes: http://autobuild.buildroot.net/results/ef6ff91086a094eb25b145d66d072c6d2fc60154/ Signed-off-by: Thomas Petazzoni --- This is an alternative solution compared to what Fabrice proposed in http://patchwork.ozlabs.org/patch/1185307/. In Fabrice's proposal, I am not a big fan of the split of PKG_PYTHON_DISTUTILS_ENV into two variables, the split is a bit arbitrary, and seems to serve only the case of libselinux. So for now, I think a solution that affects only libselinux.mk is probably more appropriate. --- package/libselinux/libselinux.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk index dd68ad9298..98db4fa89e 100644 --- a/package/libselinux/libselinux.mk +++ b/package/libselinux/libselinux.mk @@ -13,13 +13,10 @@ LIBSELINUX_DEPENDENCIES = libsepol pcre LIBSELINUX_INSTALL_STAGING = YES -# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22. # Set SHLIBDIR to /usr/lib so it has the same value than LIBDIR, as a result # we won't have to use a relative path in 0002-revert-ln-relative.patch LIBSELINUX_MAKE_OPTS = \ $(TARGET_CONFIGURE_OPTS) \ - CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \ - LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \ ARCH=$(KERNEL_ARCH) \ SHLIBDIR=/usr/lib @@ -54,6 +51,14 @@ define LIBSELINUX_BUILD_PYTHON_BINDINGS endef endif # python || python3 +# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc +# 2.22. We set CFLAGS and LDFLAGS here because we want to win over the +# CFLAGS/LDFLAGS definitions passed by $(PKG_PYTHON_DISTUTILS_ENV) +# when the python binding is enabled. +LIBSELINUX_MAKE_OPTS += \ + CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \ + LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \ + define LIBSELINUX_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ $(LIBSELINUX_MAKE_OPTS) all