2018-01-09 23:23:54

by Jason Self

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Jason Self <[email protected]>
---
tools/CMakeLists.txt | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 4d9862d..1c21fef 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -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)
--
1.9.1


Attachments:
0001-carl9170-Change-from-_COMPILER_VERSION-to-CMAKE_C_CO.patch (2.39 kB)