MaskRay created this revision. MaskRay added reviewers: DavidSpickett, phosek, smeenai, tra, tstellar. Herald added subscribers: ekilmer, s.egerton, abidh, PkmX, atanasyan, simoncook, fedor.sergeev, kristof.beyls, krytarowski, arichardson, sdardis, emaste. Herald added a project: All. MaskRay requested review of this revision. Herald added subscribers: cfe-commits, wangpc. Herald added a project: clang.
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 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D158218 Files: clang/CMakeLists.txt Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -176,6 +176,17 @@ set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." ) set(DEFAULT_SYSROOT "" CACHE STRING "Default <path> to all compiler invocations for --sysroot=<path>." ) +if(DEFAULT_SYSROOT) + message(WARNING "DEFAULT_SYSROOT is deprecated and will be removed. Use " + "configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)" + "to specify the default --sysroot=") +endif() +if(GCC_INSTALL_PREFIX) + message(WARNING "GCC_INSTALL_PREFIX is deprecated and will be removed. Use " + "configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)" + "to specify the default --gcc-install-dir=. --gcc-toolchain= is discouraged. " + "The option is often unneeded or better replaced with --gcc-install-dir=.") +endif() set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -176,6 +176,17 @@ set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." ) set(DEFAULT_SYSROOT "" CACHE STRING "Default <path> to all compiler invocations for --sysroot=<path>." ) +if(DEFAULT_SYSROOT) + message(WARNING "DEFAULT_SYSROOT is deprecated and will be removed. Use " + "configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)" + "to specify the default --sysroot=") +endif() +if(GCC_INSTALL_PREFIX) + message(WARNING "GCC_INSTALL_PREFIX is deprecated and will be removed. Use " + "configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)" + "to specify the default --gcc-install-dir=. --gcc-toolchain= is discouraged. " + "The option is often unneeded or better replaced with --gcc-install-dir=.") +endif() set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits