Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit b124740

Browse files
authored
Fix clang version detection in src/pal/tools/gen-buildsys-clang.sh (#11398)
The version detection that was added recently for the purpose of selecting optimization options for ARM builds was not working properly when the clang binary doesn't have version in its name. This resulted in syntax error being reported on OSX and some Linux distros: /Users/janvorli/git/coreclr/src/pal/tools/gen-buildsys-clang.sh: line 162: : /usr/bin/clang: syntax error: operand expected (error token is "/usr/bin/clang")
1 parent c78891a commit b124740

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pal/tools/gen-buildsys-clang.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ if [ "$build_arch" == "armel" ]; then
155155
cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
156156
fi
157157

158-
clang_version=$(echo $CC | awk -F- '{ print $NF }')
158+
clang_version=$( $CC --version | head -1 | sed 's/[^0-9]*\([0-9]*\.[0-9]*\).*/\1/' )
159159
# Use O1 option when the clang version is smaller than 3.9
160160
# Otherwise use O3 option in release build
161161
if [[ ( ${clang_version%.*} -eq 3 && ${clang_version#*.} -lt 9 ) &&

0 commit comments

Comments
 (0)