<div>No, compilation commands contain only -isystem (to 3rd party libs) and -I (to project include) directories, aside from compilation flags.</div><div> </div><div>I've seen --sysroot option available when compiling with clang, however didn't yet find a clue how to pass it to libTooling internals.</div><div> </div><div>23.03.2018, 11:02, "Александр Шапошников" <alexander.v.shaposhnikov@gmail.com>:</div><blockquote type="cite"><div>just in case, <div>I'm wondering if your compilation commands explicitly contain <div><span style="background-color:#ffffff;color:#000000;display:inline;float:none;font-family:monospace;font-size:medium;font-style:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-weight:400;text-align:start;text-transform:none;white-space:normal;">--sysroot or </span>-isysroot, i.e. see </div><div><a href="https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html">https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html</a></div></div><div>(these are gcc docs, but clang supports these options (since clang tries to be a drop-in replacement for gcc).</div><div>Kind regards,</div><div>Alexander Shaposhnikov</div></div><div> <div>On Fri, Mar 23, 2018 at 12:52 AM, Иванов Игорь via cfe-dev <span><<a target="_blank" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>></span> wrote:<blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello everyone! It seems that my previous email got tumbled away as a html attachment, so I've removed all the formating in hope that helps.<br /><br />I am writing a tool using clang's  tooling::RefactoringTool  and want to apply it to ARM targeted sources. Those rely on their own sysroot to compile, which is incomplete and basically contains only lib and usr directories with proprietary stuff. Its  /usr/include  headers also differ from my system ones - so when parsing my sources with clang tool I get a lot of parsing errors related to header ordering, etc. And of course, with vendor-provided gcc4.8 everything is fine, which led me to a conclusion there's something wrong with how I use clang.<br /><br />I've tried to surpass the problem by copying my  /lib/clang/5.0.1/include  to this sysroot (so clang builtin headers would work correctly with new include & lib) and changing my  compile_commands.json  to use  -nostdinc++ -isystem /arm-hisiv300-linux/target/usr/include -isystem /arm-hisiv300-linux/gcc/include  - so clang wouldn't rely on system headers.<br /><br />Unforntunately it doesn't fool clang - it still tries to search for some headers in my host system:<br /><br />$ arm-hisiv300-linux/bin/my-tool src/grabcommon/rtp_assemblers.cpp<br />In file included from src/grabcommon/rtp_assemblers.cpp:1:<br />...<br />In file included from /arm-hisiv300-linux/target/usr/include/limits.h:125: <- here #include_next is used to access compiler-specific <limits.h><br />In file included from /arm-hisiv300-linux/bin/../lib/clang/5.0.1/include/limits.h:37: <- here clang #include_next <limits.h><br />>>> /usr/include/limits.h:145:5 <<< error: function-like macro '__GLIBC_USE' is not defined <- here I'd expect /arm-hisiv300-linux/target/usr/include/limits.h, but get system one<br />#if __GLIBC_USE (IEC_60559_BFP_EXT)<br /><br />I believe I have to pass "sysroot" directory as an argument to my tool and somehow construct RefactoringTool / CompilationDatabase instance so it take advantage of needed include directory, but how? Or am I entirely wrong and this calls for drastic measures like recompiling clang/LLVM for my needs? I am aware that I can  mount --bind my/usr/include /usr/include  (it works!), or put everything to some arm-based distro and use qemu, so instead of cross-compiling I just compile in place. However my intention is that the tool could be used as simple as  $ my-tool --sysroot /dir file.cpp . So what are my options?<br />_______________________________________________<br />cfe-dev mailing list<br /><a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br /><a target="_blank" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></blockquote></div></div></blockquote>