<div>
                    Hello Steven,
                </div><div><br></div><div>I was a little confused by your response at first, but I think I figured it out.</div><div><br></div><div>In my llvm build directory I found the compiler headers matching the clang version of my tool:</div><div><br></div><div><span style="font-variant-ligatures: no-common-ligatures"><span class="Apple-tab-span" style="white-space:pre"> </span>.../clang-llvm/build_release/lib/clang/6.0.0/include</span></div><div><span style="font-variant-ligatures: no-common-ligatures"><br></span></div><div>If I use the path to those in the system header include paths of my tool then the errors are gone.</div><div>I guess that means I need to ship those headers with my tool and make sure they are used instead of the local ones?</div><div><br></div><div>Thank you,</div><div>Eberhard</div>
                <div><div><br></div><div><span style="font-size: 13px;">—</span></div><span style="font-family: Helvetica; font-size: 10pt; background-color: rgb(255, 255, 255);">Coati Software KG</span><br><span style="font-family: Helvetica; font-size: 10pt; background-color: rgb(255, 255, 255);">Jakob-Haringer-Straße 1/127</span><br><span style="font-family: Helvetica; font-size: 10pt; background-color: rgb(255, 255, 255);">5020 Salzburg</span><br><span style="font-family: Helvetica; font-size: 10pt; background-color: rgb(255, 255, 255);">Austria</span><br><br><span style="font-family: Helvetica; font-size: 10pt; background-color: rgb(255, 255, 255);">UID: ATU70060435</span><br><span style="font-family: Helvetica; font-size: 10pt; background-color: rgb(255, 255, 255);">registration number: FN442768f</span><br><span style="font-family: Helvetica; font-size: 10pt; background-color: rgb(255, 255, 255);">jurisdiction: Landesgericht Salzburg</span><br><br><a href="http://coati.io" style="font-family: Helvetica; font-size: 10pt; color: rgb(0, 106, 227);">https://coati.io</a><br><a href="mailto:mail@coati.io" style="font-family: Helvetica; font-size: 10pt; color: rgb(0, 106, 227);">mail@coati.io</a><div><br></div></div>
                 
                <p style="color: #A0A0A8;">On Friday, 4. May 2018 at 02:54, Steven Wu wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Hi Eberhard</div><div><br></div><div>The compiler headers (the ones in */usr/lib/clang/*/include) are rev-locked with the compiler. You cannot mismatch between different versions.</div><div><br></div><div>On the other hand, as long as you are not using compiler builtin functions, you can switch to use the compiler headers from clang 6.0 instead of the ones come with your local toolchain. That should solve your problem.</div><div><br></div><div>Steven</div><div><br></div><blockquote type="cite"><div><div>On May 3, 2018, at 11:49 AM, Eberhard Gräther via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:</div><div><br></div><div>Hello cfe-dev,</div><div><br></div><div>I’m using clang libTooling for creating a GUI developer tool, currently with clang 6.0. The tool makes use of the local system headers when analyzing source code. From my local compiler I get these system header paths:</div><div><br></div><div>    $ clang++ -x c++ -v -E /dev/null</div><div>    ...</div><div>    #include <...> search starts here:</div><div>     /usr/local/include</div><div>     /opt/local/include</div><div>     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1</div><div>     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include</div><div>     /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include</div><div>     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include</div><div>     /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks (framework directory)</div><div>    …</div><div><br></div><div><br></div><div>My local toolchain is based on Xcode:</div><div><br></div><div>    $ clang++ -v</div><div>    clang version 5.0.1 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a> 232230afd349ceeb784720d2266e2288523d871f) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a> cbc2c76b286c38a1fd006543b6b224c06cd96df1)</div><div>    Target: x86_64-apple-darwin17.5.0</div><div>    Thread model: posix</div><div>    InstalledDir: /usr/local/bin</div><div><br></div><div><br></div><div>My tool usually works fine, and most source code can be analysed without problems. But sometimes there are errors like this one:</div><div><br></div><div>    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.1.0/include/emmintrin.h:2261:19: fatal error: use of undeclared identifier '__builtin_ia32_pavgb128'</div><div>      return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b);</div><div>                      ^</div><div>    error: use of undeclared identifier ‘__builtin_ia32_pavgb128'</div><div><br></div><div><br></div><div>I found out that this problem might be related to the preprocessor definitions of my tool. My tool either uses the wrong ones or misses some. I can get a list from my local compiler and make my tool use them:</div><div><br></div><div>    $ clang++ -x c++ -E -dM /dev/null</div><div>    #define OBJC_NEW_PROPERTIES 1</div><div>    #define _LP64 1</div><div>    #define __APPLE_CC__ 6000</div><div>    #define __APPLE__ 1</div><div>    #define __ATOMIC_ACQUIRE 2</div><div>    #define __ATOMIC_ACQ_REL 4</div><div>    #define __ATOMIC_CONSUME 1</div><div>    #define __ATOMIC_RELAXED 0</div><div>    #define __ATOMIC_RELEASE 3</div><div>    …</div><div><br></div><div><br></div><div>But that just switches the problem to some other location:</div><div><br></div><div>    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdlib.h:162:54: fatal error: redefinition of parameter 'restrict'</div><div>    size_t   mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);</div><div>                                                          ^</div><div>    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/cdefs.h:209:20: note: expanded from macro '__restrict'</div><div>    #define __restrict      restrict</div><div>                            ^</div><div>    error: redefinition of parameter ‘restrict’</div><div><br></div><div><br></div><div>I couldn’t find a good resource explaining me this situation yet. What am I doing wrong here?</div><div>Is this a problem of wrong/missing preprocessor definitions?</div><div>Or does my clang 6.0 tool not match with my local clang 5.0.1 toolchain’s system headers?</div><div>Do I need to ship certain system headers with my tool?</div><div><br></div><div>Thank you,</div><div>Eberhard Gräther</div><div><br></div><div><br></div><div>_______________________________________________</div><div>cfe-dev mailing list</div><div><a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a></div><div><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></div></div></blockquote></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div>
                    <br>
                </div>