Specifying DEFAULT_SYSROOT and GCC_INSTALL_PREFIX can cause many
clang/test/Driver failures, e.g. non-empty DEFAULT_SYSROOT causes:
Failed Tests (14): Clang :: Driver/baremetal.cpp Clang :: Driver/csky-toolchain.c Clang :: Driver/freebsd-include-paths.c Clang :: Driver/hexagon-toolchain-elf.c Clang :: Driver/hexagon-toolchain-linux.c Clang :: Driver/mips-cs.cpp Clang :: Driver/mips-fsf.cpp Clang :: Driver/mips-img-v2.cpp Clang :: Driver/mips-img.cpp Clang :: Driver/riscv32-toolchain-extra.c Clang :: Driver/riscv64-toolchain-extra.c Clang :: Driver/rocm-detect.hip Clang :: Driver/solaris-ld.c Clang :: Driver/sysroot.c
The two CMake variables are partially responsible for many
--sysroot=/ --sysroot=""/--gcc-toolchain=/--gcc-toolchain=""` in
clang/test/Driver: some contributors add them to fix tests and some just
do cargo culting.
This is not healthy for contributors adding cross compilation support.
Configuration files are perfect replacement.
Link: https://discourse.llvm.org/t/add-gcc-install-dir-deprecate-gcc-toolchain-and-remove-gcc-install-prefix/65091
Link: https://discourse.llvm.org/t/correct-cmake-parameters-for-building-clang-and-lld-for-riscv/72833
I hope that people can help port some docs:
clang/cmake/caches/CrossWinToARMLinux.cmake
libc/docs/full_host_build.rst
At one time I believe that the clang configuration files could not specify paths relative to the clang executable. AFAICT DEFAULT_SYSROOT does support this.
But if I'm mistaken about that can we add an example to the docs at https://clang.llvm.org/docs/UsersManual.html#configuration-files illustrating how to use a relative sysroot?