From: Yuxuan Shui <yshuiv7@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: masahiroy@kernel.org, michal.lkml@markovi.net,
linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: [PATCH] kbuild: compile_h: fix compiler version detection with clang
Date: Thu, 14 May 2020 23:19:05 +0100 [thread overview]
Message-ID: <87imgykunh.fsf@m5Zedd9JOGzJrf0> (raw)
[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]
In some setup clang will print a line about CUDA version it detects,
like this:
Found CUDA installation: /opt/cuda, version 10.1
So grepping ' version ' matches 2 lines, and results in a broken string in
compiler.h, which doesn't compile.
This commit adds a "head -n1" to fix this problem.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
---
scripts/mkcompile_h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 5b80a4699740..8e6b4fc6fdd9 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -62,7 +62,7 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)"
printf '#define LINUX_COMPILE_BY "%s"\n' "$LINUX_COMPILE_BY"
echo \#define LINUX_COMPILE_HOST \"$LINUX_COMPILE_HOST\"
- CC_VERSION=$($CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//')
+ CC_VERSION=$($CC -v 2>&1 | grep ' version ' | head -n1 | sed 's/[[:space:]]*$//')
LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \
| sed 's/[[:space:]]*$//')
printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION"
--
2.26.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next reply other threads:[~2020-05-14 22:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 22:19 Yuxuan Shui [this message]
2020-05-14 23:25 ` [PATCH] kbuild: compile_h: fix compiler version detection with clang Nick Desaulniers
2020-05-15 0:42 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87imgykunh.fsf@m5Zedd9JOGzJrf0 \
--to=yshuiv7@gmail.com \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox