You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is due to clang-14 removing parsing of -gcc-toolchain in favor or --gcc-toolchain=
Reproduction Steps
Clone tag v7.0.0-preview.7.22375.6
Build using ROOTFS_DIR="$CBUILDROOT" ./build.sh -arch arm64 -c Release -cross -clang
where CBUILDROOT is your ROOTFS_DIR (in Alpine's case, $HOME/sysroot-arm64)
Expected behavior
--gcc-toolchain= should be used
Actual behavior
-gcc-toolchain used instead
Regression?
This also affects runtime v6.0.8
Known Workarounds
On v6.0.8, the following workaround was used:
let build fail
execute following to replace bad arguments
_sedlist="
pal/src/libunwind/src/CMakeFiles/libunwind.dir/build.make
pal/src/CMakeFiles/coreclrpal.dir/build.make
vm/wks/CMakeFiles/cee_wks_core.dir/build.make
dlls/mscordac/CMakeFiles/mscordaccore.dir/build.make
debug/di/CMakeFiles/cordbdi.dir/build.make
debug/createdump/CMakeFiles/createdump.dir/build.make
debug/ee/wks/CMakeFiles/cordbee_wks_obj.dir/build.make
dlls/mscordbi/CMakeFiles/mscordbi.dir/build.make
"
for i in $_sedlist; do
sed 's| -gcc-toolchain | --gcc-toolchain=|' -i artifacts/obj/coreclr/Linux.*.Release/$i || true
done
start build again
Unfortunately, this does not work on version 7.0.0-preview.7, as build.make seems to be regenerated every build.
# This is a workaround for upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22995.
#
# In Clang.cmake, the decision to use single or double hyphen for target and gcc-toolchain
# is made based on CMAKE_${LANG}_COMPILER_VERSION, but CMAKE_ASM_COMPILER_VERSION is empty
# so it picks up single hyphen options, which new clang versions don't recognize.
set (CMAKE_ASM_COMPILER_VERSION"${CMAKE_C_COMPILER_VERSION}")
# This is a workaround for upstream issue: https://gitlab.kitware.com/cmake/cmake/-/issues/22995.
#
# In Clang.cmake, the decision to use single or double hyphen for target and gcc-toolchain
# is made based on CMAKE_${LANG}_COMPILER_VERSION, but CMAKE_ASM_COMPILER_VERSION is empty
# so it picks up single hyphen options, which new clang versions don't recognize.
set (CMAKE_ASM_COMPILER_VERSION"${CMAKE_C_COMPILER_VERSION}")
Activity
jkotas commentedon Sep 13, 2022
Does applying this workaround fix the problem for you?
runtime/eng/native/configurecompiler.cmake
Lines 791 to 796 in cfd6cd1
ayakael commentedon Sep 13, 2022
That did it, thanks!
jkotas commentedon Sep 13, 2022
Let's keep this open for .NET 7 backport
Workaround for building with clang-14
Workaround for building with clang-14 (#75510)
hoyosjs commentedon Sep 20, 2022
Fixed in 7.0 and 6.0.