Skip to contentSkip to conversation

carl9170: Change from _COMPILER_VERSION to CMAKE_C_COMPILER_VERSION

PATCH New Jason Self 1 participant 1 message Jan 9, 2018

lore
Share & tools
lore

Jason Self

author
#0 lore raw

PATCH 1/1 carl9170: Change from _COMPILER_VERSION to CMAKE_C_COMPILER_VERSION

Patch is attached.

My problem started off this way:

git clone https://github.com/chunkeey/carl9170fw.git
cd carl9170fw
make -C toolchain
(time passes)
./autogen.sh
(accept all default answers)
./autogen.sh install
Installing firmware...Apply miniboot..../autogen.sh: line 35:
tools/src/miniboot: No such file or directory

So somewhere in the process miniboot wasn't being built. I confirmed that tools/src/miniboot really didn't exist, since dynamic linking problems can confusingly cause the same error.

After some research it was determined that miniboot wasn't being built because the conditional in tools/CMakeLists.txt for the compiler version determined that the detected version of GCC was less than version 44.

This machine is running GCC 7.2. gcc -dumpversion prints '7', which is lower than 44. It also doesn't match the regular expression for _COMPILER_VERSION, which expects at least two numbers separated by a dot. _COMPILER_VERSION seems to be mangled in a way that is not compatible with recent versions of GCC but there's no reason to mangle it as far as I can tell because VERSION_GREATER can compare dots but then that seems to make _COMPILER_VERSION unnecessary, considering that CMAKE already sets CMAKE_C_COMPILER_VERSION.

So the idea of this patch is to change tools/CMakeLists.txt to use CMAKE_C_COMPILER_VERSION instead of _COMPILER_VERSION, and compare with 4.4 instead of 44 so that the conditional can be met and miniboot can be built.

---
 tools/CMakeLists.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/CMakeLists.txt +2 -4
index 4d9862d..1c21fef 100644
@@ -11,10 +11,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/extra)
 include(GCCVersion)
 include("../config.cmake")
 
-_COMPILER_DUMPVERSION(_COMPILER_VERSION)
-
-if (("${_COMPILER_VERSION}" VERSION_GREATER 44) OR
-    ("${_COMPILER_VERSION}" VERSION_EQUAL 44))
+if (("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER 4.4) OR
+    ("${CMAKE_C_COMPILER_VERSION}" VERSION_EQUAL 4.4))
 
 	include_directories (../include/linux ../include/shared 

../include lib include)
add_subdirectory(lib)

Signature · 1 line
1.9.1

From fdbf694ade1c00c47b3c5823c75fab0607d8531f Mon Sep 17 00:00:00 2001
From: Jason Self <[email protected]>
Date: Tue, 9 Jan 2018 14:12:18 -0800
Subject: [PATCH] carl9170: Change from _COMPILER_VERSION to
CMAKE_C_COMPILER_VERSION

My problem started off this way:

git clone https://github.com/chunkeey/carl9170fw.git
cd carl9170fw
make -C toolchain
(time passes)
./autogen.sh
(accept all default answers)
./autogen.sh install
Installing firmware...Apply miniboot..../autogen.sh: line 35: tools/src/miniboot: No such file or directory

So somewhere in the process miniboot wasn't being built. I confirmed that tools/src/miniboot really didn't exist, since dynamic linking problems can confusingly cause the same error.

After some research it was determined that miniboot wasn't being built because the conditional in tools/CMakeLists.txt for the compiler version determined that the detected version of GCC was less than version 44.

This machine is running GCC 7.2. gcc -dumpversion prints '7', which is lower than 44. It also doesn't match the regular expression for _COMPILER_VERSION, which expects at least two numbers separated by a dot. _COMPILER_VERSION seems to be mangled in a way that is not compatible with recent versions of GCC but there's no reason to mangle it as far as I can tell because VERSION_GREATER can compare dots but then that seems to make _COMPILER_VERSION unnecessary, considering that CMAKE already sets CMAKE_C_COMPILER_VERSION.

So the idea of this patch is to change tools/CMakeLists.txt to use CMAKE_C_COMPILER_VERSION instead of _COMPILER_VERSION, and compare with 4.4 instead of 44 so that the conditional can be met and miniboot can be built.

---
 tools/CMakeLists.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/CMakeLists.txt +2 -4
index 4d9862d..1c21fef 100644
@@ -11,10 +11,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/extra)
 include(GCCVersion)
 include("../config.cmake")
 
-_COMPILER_DUMPVERSION(_COMPILER_VERSION)
-
-if (("${_COMPILER_VERSION}" VERSION_GREATER 44) OR
-    ("${_COMPILER_VERSION}" VERSION_EQUAL 44))
+if (("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER 4.4) OR
+    ("${CMAKE_C_COMPILER_VERSION}" VERSION_EQUAL 4.4))
 
 	include_directories (../include/linux ../include/shared ../include lib include)
 	add_subdirectory(lib)
Signature · 1 line
1.9.1