IWYU change selected gcc installation

352 Views Asked by At

Include What You Use is failing to lint files with c++ 17 headers. It reports an error that it can not find them.

When I run iwyu -v it says it is using devtoolset 7 but I have devtoolset 11 installed and I want it to use 11 instead.

$ iwyu -v
clang version 12.0.1
...
Found candidate GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Selected GCC installation: /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
...

How do I get IWYU to use a different version of gcc?

1

There are 1 best solutions below

0
On BEST ANSWER

There is a clang option, -gcc-toolchain, which takes the path to a gcc toolchain. The path should be to the usr directory. Adding this option fixed the issue

$ iwyu -gcc-toolchain /opt/rh/devtoolset-ll/root/usr