From patchwork Sat Oct 13 15:58:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 191300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 07CC12C008B for ; Sun, 14 Oct 2012 02:58:40 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 19EED2E081; Sat, 13 Oct 2012 15:58:38 +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 n39s4xGbO7Fw; Sat, 13 Oct 2012 15:58:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 609AA25651; Sat, 13 Oct 2012 15:58:35 +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 919598F74A for ; Sat, 13 Oct 2012 15:58:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C08008ED1C for ; Sat, 13 Oct 2012 15:58:33 +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 JrcwwgMLB1Lv for ; Sat, 13 Oct 2012 15:58:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [88.190.12.23]) by whitealder.osuosl.org (Postfix) with ESMTP id 3880586232 for ; Sat, 13 Oct 2012 15:58:32 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id EBB0516D; Sat, 13 Oct 2012 17:58:22 +0200 (CEST) Received: from localhost (unknown [82.247.183.72]) by mail.free-electrons.com (Postfix) with ESMTPSA id C76C015C for ; Sat, 13 Oct 2012 17:58:14 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Sat, 13 Oct 2012 17:58:11 +0200 Message-Id: <1350143891-5626-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 Subject: [Buildroot] [PATCH] gpsd: add patch to fix CPPFLAGS related build issue 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net In gpsd, some of the environment variables carrying flags are handled specially when they can contain multiple flags enclosed inside quotes. The gpsd SConstruct uses env.MergeFlags() do add those flags. Unfortunately, env.MergeFlags() doesn't work properly when this quoted string starts with a space. The build then fails with: arm-unknown-linux-uclibcgnueabi-gcc: error: -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64: No such file or directory This is because Scons believes that " -flag1 -flag2" is a file and not a set of flags. We fix this by adding a patch that simply strip()s the string before passing it to env.MergeFlags(), which has the effect of removing all leading and trailing spaces. Fixes http://autobuild.buildroot.org/results/acf4922e1538d50eb30e4750ee2ec0fba891e1ce/build-end.log Thanks to Gustavo Zacarias for the initial investigation. He is the one who found that the leading space was causing the problem. Signed-off-by: Thomas Petazzoni --- ...6-sconstruct-fix-multiword-flags-handling.patch | 35 ++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 package/gpsd/gpsd-06-sconstruct-fix-multiword-flags-handling.patch diff --git a/package/gpsd/gpsd-06-sconstruct-fix-multiword-flags-handling.patch b/package/gpsd/gpsd-06-sconstruct-fix-multiword-flags-handling.patch new file mode 100644 index 0000000..40b51ed --- /dev/null +++ b/package/gpsd/gpsd-06-sconstruct-fix-multiword-flags-handling.patch @@ -0,0 +1,35 @@ +Some of the environment variables carrying flags are handled specially +when they can contain multiple flags enclosed inside quotes. The gpsd +SConstruct uses env.MergeFlags() do add those flags. + +Unfortunately, env.MergeFlags() doesn't work properly when this quoted +string starts with a space. The build then fails with: + + arm-unknown-linux-uclibcgnueabi-gcc: error: -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64: No such file or directory + +This is because Scons believes that " -flag1 -flag2" is a file and not +a set of flags. + +We fix this by simply strip()ing the string before passing it to +env.MergeFlags(), which has the effect of removing all leading and +trailing spaces. + +See +http://autobuild.buildroot.org/results/acf4922e1538d50eb30e4750ee2ec0fba891e1ce/build-end.log +for a complete example of build failure. + +Signed-off-by: Thomas Petazzoni + +Index: b/SConstruct +=================================================================== +--- a/SConstruct ++++ b/SConstruct +@@ -236,7 +236,7 @@ + env.Replace(**{j: os.getenv(i)}) + for flags in ["LDFLAGS", "LINKFLAGS", "SHLINKFLAGS", "CPPFLAGS"]: + if os.environ.has_key(flags): +- env.MergeFlags({flags : [os.getenv(flags)]}) ++ env.MergeFlags({flags : [os.getenv(flags).strip()]}) + + + # Keep scan-build options in the environment