From patchwork Fri May 2 14:59:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 345018 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 99A1D14007B for ; Sat, 3 May 2014 01:06:03 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E434E8C828; Fri, 2 May 2014 15:06:02 +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 L8FFacrFEFtf; Fri, 2 May 2014 15:05:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 5262E8C821; Fri, 2 May 2014 15:05:57 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 552981BF857 for ; Fri, 2 May 2014 15:05:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4EBC48B78C for ; Fri, 2 May 2014 15:05:54 +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 r4b-b63VPRxI for ; Fri, 2 May 2014 15:05:52 +0000 (UTC) X-Greylist: delayed 00:05:31 by SQLgrey-1.7.6 Received: from zose-mta03.web4all.fr (zose-mta03.web4all.fr [213.152.15.69]) by whitealder.osuosl.org (Postfix) with ESMTP id D61438C804 for ; Fri, 2 May 2014 15:05:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zose-mta03.web4all.fr (Postfix) with ESMTP id 4C9A441890 for ; Fri, 2 May 2014 17:00:14 +0200 (CEST) Received: from zose-mta03.web4all.fr ([127.0.0.1]) by localhost (zose-mta03.web4all.fr [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id OL_IZtM5YX3H; Fri, 2 May 2014 17:00:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zose-mta03.web4all.fr (Postfix) with ESMTP id 0B2744185E; Fri, 2 May 2014 17:00:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at zose-mta-03.w4a.fr Received: from zose-mta03.web4all.fr ([127.0.0.1]) by localhost (zose-mta03.web4all.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id m6TY058wCoP6; Fri, 2 May 2014 17:00:09 +0200 (CEST) Received: from localhost.localdomain (unknown [78.250.227.104]) by zose-mta03.web4all.fr (Postfix) with ESMTPA id CB9114187E; Fri, 2 May 2014 17:00:09 +0200 (CEST) From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= To: buildroot@busybox.net Date: Fri, 2 May 2014 16:59:24 +0200 Message-Id: <1399042764-22388-2-git-send-email-benoit.thebaudeau@advansee.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1399042764-22388-1-git-send-email-benoit.thebaudeau@advansee.com> References: <1399042764-22388-1-git-send-email-benoit.thebaudeau@advansee.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH] lsof: fix "'TCP_*' undeclared" build errors X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net With some configurations, cross-building lsof results in the following errors: .../host/usr/bin/ccache .../host/usr/bin/arm-926ej_s_soft_float-linux-gnueabi-gcc -DLINUXV=311010 -DHASIPv6 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DHAS_STRFTIME -DLSOF_VSTR=\"3.11.10\" -I.../host/usr/arm-unknown-linux-gnueabi/sysroot/usr/include -pipe -O2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -c -o dsock.o dsock.c dsock.c: In function 'build_IPstates': dsock.c:243:49: error: 'TCP_ESTABLISHED' undeclared (first use in this function) dsock.c:243:49: note: each undeclared identifier is reported only once for each function it appears in dsock.c:244:46: error: 'TCP_SYN_SENT' undeclared (first use in this function) dsock.c:245:46: error: 'TCP_SYN_RECV' undeclared (first use in this function) dsock.c:246:47: error: 'TCP_FIN_WAIT1' undeclared (first use in this function) dsock.c:247:47: error: 'TCP_FIN_WAIT2' undeclared (first use in this function) dsock.c:248:47: error: 'TCP_TIME_WAIT' undeclared (first use in this function) dsock.c:249:43: error: 'TCP_CLOSE' undeclared (first use in this function) dsock.c:250:48: error: 'TCP_CLOSE_WAIT' undeclared (first use in this function) dsock.c:251:46: error: 'TCP_LAST_ACK' undeclared (first use in this function) dsock.c:252:44: error: 'TCP_LISTEN' undeclared (first use in this function) dsock.c:253:45: error: 'TCP_CLOSING' undeclared (first use in this function) These errors are caused by the glibc not being detected at configure time: Testing C library type with cc ... done Cannot determine C library type; assuming it is not glibc. Changing the Configure file in order not to hide the output of the build of this configure test shows that this is a build error: In file included from /usr/include/stdc-predef.h:30:0, from :0: .../host/usr/arm-unknown-linux-gnueabi/sysroot/usr/include/bits/predefs.h:20:3: error: #error "Never use directly; include instead." # error "Never use directly; include instead." ^ This is a conflict between the header files of the native toolchain on the build machine and the header files of the cross-toolchain. lsof uses the native toolchain by default to perform configure tests, even if cross-building. Since this specific configure test only looks at the definitions in the header files of the cross-toolchain, forcing the sysroot of the native toolchain to the one of the cross-toolchain does the trick in order to avoid mixing header files. Of course, not using the native toolchain for those configure tests would be the best, but this simple change seems to be sufficient in the meantime. Signed-off-by: Benoît Thébaudeau --- package/lsof/lsof.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/lsof/lsof.mk b/package/lsof/lsof.mk index aa101e4..66d2133 100644 --- a/package/lsof/lsof.mk +++ b/package/lsof/lsof.mk @@ -47,7 +47,8 @@ endef define LSOF_CONFIGURE_CMDS (cd $(@D) ; \ echo n | $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" \ - LSOF_INCLUDE="$(STAGING_DIR)/usr/include" LSOF_CFLAGS_OVERRIDE=1 ./Configure linux) + LSOF_INCLUDE="$(STAGING_DIR)/usr/include" LSOF_CFLAGS_OVERRIDE=1 \ + LSOF_CC="cc --sysroot $(STAGING_DIR)" ./Configure linux) $(LSOF_CONFIGURE_WCHAR_FIXUPS) $(LSOF_CONFIGURE_LOCALE_FIXUPS) endef