[PATCH] D49244: Always search sysroot for GCC installs

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 28 11:40:04 PDT 2018

rsmith added a comment.

I think `-gcc-toolchain`, if specified, should simply be taken as the location of the GCC toolchain; we should never go looking for it anywhere else if `-gcc-toolchain` is specified. So I think the patch is not quite right as-is, as it also affects that case. I think these alternatives both seem reasonable:

- if `-gcc-toolchain` is not specified, and `--sysroot` is specified, then also look in the sysroot for GCC as normal after checking in `GCC_INSTALL_PREFIX`
- if `--sysroot` is specified, ignore `GCC_INSTALL_PREFIX` when computing the GCC toolchain directory

(The difference would be that in the former case we'd use a GCC that's not within the sysroot if `GCC_INSTALL_PREFIX` names a suitable toolchain, and in the latter case we would not.)

I think my preference is the second option: `GCC_INSTALL_PREFIX` should only be taken as specifying the installation prefix for the default sysroot specified at configure time. If `--sysroot` is explicitly specified, `GCC_INSTALL_PREFIX` should be ignored (but `-gcc-toolchain` should still be respected, and if specified we should not go looking for a toolchain in the sysroot ourselves.)

  rC Clang


More information about the cfe-commits mailing list