From patchwork Mon Nov 30 15:40:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Rebello X-Patchwork-Id: 550180 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 9B063140271 for ; Tue, 1 Dec 2015 02:40:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=WXynwTWa; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C9DEC32042; Mon, 30 Nov 2015 15:40:58 +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 NFo6nrH-w4iz; Mon, 30 Nov 2015 15:40:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id C06F131FA4; Mon, 30 Nov 2015 15:40:56 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 100FB1C0361 for ; Mon, 30 Nov 2015 15:40:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 093F186B40 for ; Mon, 30 Nov 2015 15:40:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fgtC3SbciGnL for ; Mon, 30 Nov 2015 15:40:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk0-f170.google.com (mail-qk0-f170.google.com [209.85.220.170]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 3865F86A8B for ; Mon, 30 Nov 2015 15:40:54 +0000 (UTC) Received: by qkao63 with SMTP id o63so59882900qka.2 for ; Mon, 30 Nov 2015 07:40:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=ajMYR+yjZQkWpdILBDTQHMSuKWYctc5++PyVx2n7rSw=; b=WXynwTWawErWNE4wkjAdD8O935DrsXupySObq7EDzXBmYGe+ae3M/74k0Lifps0ScE keljm79/yszfwoxbQ1jNEbLSRsvqDk4INODKtEVjmqXcAVmRwycVTSLfB8kcEdllNSA+ B6TGY9uDbto/22zz8Hdj9ucK42QNdJvD+xaYeTQuTDDqJlQ0vkFc7LGg+qnokhguHpHn 14YBUE4DvLkAIv850n5V8HMi2qXoUyxrbl012l6CtY49tt6KX53ikRW1NIFr04aDPqCR DwdjXRNt/MtjGNZdKlBpBS3abq0Z9Jt0/jRjhto2ij6f8Gn16/KmGNnfHu3XF98wGu8/ c6+Q== X-Received: by 10.55.203.151 with SMTP id u23mr72315974qkl.84.1448898053411; Mon, 30 Nov 2015 07:40:53 -0800 (PST) Received: from PKL1114.parks.local (pkproxy.parks.com.br. [186.227.188.5]) by smtp.gmail.com with ESMTPSA id q133sm14941945qhq.20.2015.11.30.07.40.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Nov 2015 07:40:52 -0800 (PST) From: Rodrigo Rebello To: buildroot@buildroot.org Date: Mon, 30 Nov 2015 13:40:39 -0200 Message-Id: <1448898039-27784-1-git-send-email-rprebello@gmail.com> X-Mailer: git-send-email 2.1.4 Subject: [Buildroot] [PATCH 1/1] conntrack-tools: work around build issue with musl X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Building conntrack-tools with kernel headers >= 4.2 + musl fails due to a well-known symbol clash that occurs when userspace and kernel headers are included simultaneously (see [1], question 7, for details). In the case of conntrack-tools, the inclusion of both 'netinet/in.h' and 'linux/in.h' occurs inside the C helper files (src/helpers/*.c) indirectly via e.g. 'libnetfilter_conntrack/libnetfilter_conntrack.h', which itself includes 'netinet/in.h', and 'linux/netfilter.h', which includes 'linux/in.h' in kernel headers >= 4.2. The approach to solving this type of conflict with musl usually involves removing the inclusion of kernel headers or refactoring the code so as to avoid the mentioned simultaneous inclusion. This is unfortunately non-trivial in the case of conntrack-tools since the clashing headers get included indirectly by headers that are strictly necessary (because of definitions used in some helper callbacks). Work around the issue by defining __GLIBC__ when musl is used. This eliminates the conflicts as the kernel headers avoid redefining certain symbols when they see __GLIBC__ defined (linux/libc-compat.h). Note that other glibc-compatible libraries, like uClibc, already do that internally. Fixes: http://autobuild.buildroot.net/results/66e/66ec247fa0fc385bef8d2084c65bf5cad3a8e8ca/ http://autobuild.buildroot.net/results/624/624a0d48decd819eb58cbb3c58ee904b87ebfb21/ [1] http://wiki.musl-libc.org/wiki/FAQ Signed-off-by: Rodrigo Rebello --- package/conntrack-tools/conntrack-tools.mk | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/package/conntrack-tools/conntrack-tools.mk b/package/conntrack-tools/conntrack-tools.mk index eac5841..7287587 100644 --- a/package/conntrack-tools/conntrack-tools.mk +++ b/package/conntrack-tools/conntrack-tools.mk @@ -13,10 +13,22 @@ CONNTRACK_TOOLS_DEPENDENCIES = host-pkgconf \ CONNTRACK_TOOLS_LICENSE = GPLv2+ CONNTRACK_TOOLS_LICENSE_FILES = COPYING +CONNTRACK_TOOLS_CFLAGS = $(TARGET_CFLAGS) + +# Some of conntrack-tools source files include both linux/in.h (via +# linux/netfilter.h for kernel headers >= 4.2) and netinet/in.h, which +# causes some symbol conflicts when musl is used. Defining __GLIBC__ +# works around that issue since the kernel headers are prepared to +# avoid redefinition of certain symbols when they see __GLIBC__. +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) +CONNTRACK_TOOLS_CFLAGS += -D__GLIBC__ +endif + ifeq ($(BR2_PACKAGE_LIBTIRPC),y) -CONNTRACK_TOOLS_CONF_ENV += \ - CFLAGS="$(TARGET_CFLAGS) `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`" +CONNTRACK_TOOLS_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc` CONNTRACK_TOOLS_DEPENDENCIES += libtirpc host-pkgconf endif +CONNTRACK_TOOLS_CONF_ENV = CFLAGS="$(CONNTRACK_TOOLS_CFLAGS)" + $(eval $(autotools-package))