[dpdk-dev,1/2] mk: get correct clang version

Message ID 1469451349-27653-1-git-send-email-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Ferruh Yigit July 25, 2016, 12:55 p.m. UTC
  -dumpversion is for gcc compatibility and doesn't return actual clang
version. -dumpversion only returns 4.2.1 for a long time.

Fixes: 2ef6eea891e5 ("mk: add clang toolchain")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 mk/toolchain/clang/rte.toolchain-compat.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Bruce Richardson July 25, 2016, 3:21 p.m. UTC | #1
On Mon, Jul 25, 2016 at 01:55:48PM +0100, Ferruh Yigit wrote:
> -dumpversion is for gcc compatibility and doesn't return actual clang
> version. -dumpversion only returns 4.2.1 for a long time.
> 
> Fixes: 2ef6eea891e5 ("mk: add clang toolchain")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Confirm this set fixes the issues with shared lib compile on FreeBSD.

Tested-by: Bruce Richardson <bruce.richardson@intel.com>
  
Thomas Monjalon July 25, 2016, 3:48 p.m. UTC | #2
2016-07-25 16:21, Bruce Richardson:
> On Mon, Jul 25, 2016 at 01:55:48PM +0100, Ferruh Yigit wrote:
> > -dumpversion is for gcc compatibility and doesn't return actual clang
> > version. -dumpversion only returns 4.2.1 for a long time.
> > 
> > Fixes: 2ef6eea891e5 ("mk: add clang toolchain")
> > 
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Confirm this set fixes the issues with shared lib compile on FreeBSD.
> 
> Tested-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks
  

Patch

diff --git a/mk/toolchain/clang/rte.toolchain-compat.mk b/mk/toolchain/clang/rte.toolchain-compat.mk
index f995b0b..03e5a97 100644
--- a/mk/toolchain/clang/rte.toolchain-compat.mk
+++ b/mk/toolchain/clang/rte.toolchain-compat.mk
@@ -38,6 +38,8 @@ 
 
 # find out CLANG version
 
-CLANG_MAJOR_VERSION = $(shell $(CC) -dumpversion | cut -f1 -d.)
+CLANG_VERSION := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/")
 
-CLANG_MINOR_VERSION = $(shell $(CC) -dumpversion | cut -f2 -d.)
+CLANG_MAJOR_VERSION := $(shell echo $(CLANG_VERSION) | cut -f1 -d.)
+
+CLANG_MINOR_VERSION := $(shell echo $(CLANG_VERSION) | cut -f2 -d.)