From patchwork Fri Nov 17 15:14:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 839051 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydj576x2Xz9s1h for ; Sat, 18 Nov 2017 02:41:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D15BE29A30; Fri, 17 Nov 2017 15:41:07 +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 OJapqnPXwS7B; Fri, 17 Nov 2017 15:41:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id E5CAA26BB8; Fri, 17 Nov 2017 15:41:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id AC34A1C3F9D for ; Fri, 17 Nov 2017 15:14:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A1B3B82115 for ; Fri, 17 Nov 2017 15:14:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dF45zdBpcEnH for ; Fri, 17 Nov 2017 15:14:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by hemlock.osuosl.org (Postfix) with ESMTP id 1666E8214C for ; Fri, 17 Nov 2017 15:14:19 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 85D962074A; Fri, 17 Nov 2017 16:14:17 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 58A5A203B7; Fri, 17 Nov 2017 16:14:17 +0100 (CET) From: Thomas Petazzoni To: buildroot@buildroot.org Date: Fri, 17 Nov 2017 16:14:16 +0100 Message-Id: <20171117151416.26736-1-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.13.6 Subject: [Buildroot] [PATCH] libfastjson: indicate explicitly which gcc -std option to use X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This commit fixes the following build issue of libfastjson with old enough compilers (4.8) and wchar disabled: json_object.c: In function 'fjson_object_object_delete': json_object.c:385:3: error: 'for' loop initial declarations are only allowed in C99 mode for (int i = 0 ; i < FJSON_OBJECT_CHLD_PG_SIZE ; ++i) { ^ The code of libfastjson requires C99. If your compiler is recent enough (gcc 5.x), then no problem, it is C99 by default, no additional flags are needed. If your compiler is older (for example gcc 4.8), then -std=c99 or -std=gnu99 is explicitly needed to tell the compiler to accept C99 constructs. Testing the compiler for the availability of such flags is done by libfastjson configure script. However, the test program used by the configure script uses some wchar_t types, and therefore the test checking for C99 availability fails on toolchains with wchar disabled. From config.log: configure:3928: checking for /home/test/buildroot/output/host/usr/bin/i586-buildroot-linux-uclibc-gcc option to accept ISO C99 [...] configure:4077: /home/test/buildroot/output/host/usr/bin/i586-buildroot-linux-uclibc-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5 conftest.c:54:3: error: unknown type name 'wchar_t' const wchar_t *name; ^ So, just like we did in libv4l in commit f01396a158f14c53b781c35f7ff29da0bea8c8d6 ("libv4l: fix uclibc-ng configure/compile"), let's hint directly the configure script that it should use -std=gnu99. This fixes the build of libfastjson with old compilers and wchar disabled. Signed-off-by: Thomas Petazzoni --- package/libfastjson/libfastjson.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/libfastjson/libfastjson.mk b/package/libfastjson/libfastjson.mk index b1cdd6a158..06da0d8edd 100644 --- a/package/libfastjson/libfastjson.mk +++ b/package/libfastjson/libfastjson.mk @@ -7,6 +7,7 @@ LIBFASTJSON_VERSION = v0.99.4 LIBFASTJSON_SITE = $(call github,rsyslog,libfastjson,$(LIBFASTJSON_VERSION)) LIBFASTJSON_INSTALL_STAGING = YES +LIBFASTJSON_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99' # From git LIBFASTJSON_AUTORECONF = YES LIBFASTJSON_LICENSE = MIT