From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 92AB837B4; Thu, 6 Apr 2017 16:12:34 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 13FFE201A7; Thu, 6 Apr 2017 16:12:24 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, stable@dpdk.org Date: Thu, 6 Apr 2017 16:12:41 +0200 Message-Id: <20170406141241.14061-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH] mk: fix shell errors when building with clang X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2017 14:12:34 -0000 On my system, the version of the compiler is not properly retrieved, resulting in strange logs when building the dpdk: /bin/sh: line 0: test: too many arguments This happens when mk/toolchain/clang/rte.toolchain-compat.mk is included from a directory that use gcc to build (ex: kernel modules). In that case, the CLANG_VERSION variable contains spaces that breaks some shell calls to the test program. The error is because the output of "gcc -v" on my system contains 2 lines that matches the "version" string: Configured with: ../src/configure -v \ --with-pkgversion='Debian 6.3.0-6' [...] gcc version 6.3.0 20170205 (Debian 6.3.0-6) This may be specific to Debian. Fix it by specializing the grep. Fixes: 2ef6eea891e5 ("mk: add clang toolchain") Cc: stable@dpdk.org Signed-off-by: Olivier Matz --- mk/toolchain/clang/rte.toolchain-compat.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mk/toolchain/clang/rte.toolchain-compat.mk b/mk/toolchain/clang/rte.toolchain-compat.mk index b734413b6..9e095d38b 100644 --- a/mk/toolchain/clang/rte.toolchain-compat.mk +++ b/mk/toolchain/clang/rte.toolchain-compat.mk @@ -38,7 +38,8 @@ # find out CLANG version -CLANG_VERSION := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/") +CLANG_VERSION := $(shell $(CC) -v 2>&1 | \ + sed -n "s/.*version \([0-9]*\.[0-9]*\).*/\1/p") CLANG_MAJOR_VERSION := $(shell echo $(CLANG_VERSION) | cut -f1 -d.) -- 2.11.0