<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang omits valid c++ search path when -isysroot is set to SDKs in Xcode.app"
   href="https://llvm.org/bugs/show_bug.cgi?id=30647">30647</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang omits valid c++ search path when -isysroot is set to SDKs in Xcode.app
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>howarth.mailing.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The llvm.org clang compiler omits a usable search path for the system c++
headers when the -isysroot option is set to an SDK from Xcode.app. For
example...

$ clang++-4.0 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-v -c hello.cc 
clang version 4.0.0 (trunk)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /sw/bin
 "/sw/opt/llvm-4.0/bin/clang-4.0" -cc1 -triple x86_64-apple-macosx10.12.0
-Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name hello.cc -mrelocation-model pic -pic-level 2 -mthread-model
posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 274.1 -v -dwarf-column-info -debugger-tuning=lldb
-coverage-notes-file /Users/howarth/hello.gcno -resource-dir
/sw/opt/llvm-4.0/bin/../lib/clang/4.0.0 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/howarth
-ferror-limit 19 -fmessage-length 161 -stack-protector 1 -fblocks
-fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature
-fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option
-fcolor-diagnostics -o hello.o -x c++ hello.cc
clang -cc1 version 4.0.0 based upon LLVM 4.0.0 default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory "/sw/opt/llvm-4.0/bin/../include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /sw/opt/llvm-4.0/bin/../lib/clang/4.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks
(framework directory)
End of search list.
hello.cc:1:10: fatal error: 'iostream' file not found
#include <iostream>
        ^
1 error generated.

whereas Apple clang-800.0.42 produces...

$ clang++ -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-v -c hello.cc
Apple LLVM version 8.0.0 (clang-800.0.42)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
-cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage
-Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name hello.cc
-mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 274.1
-v -dwarf-column-info -debugger-tuning=lldb -coverage-file
/Users/howarth/hello.cc -resource-dir
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/howarth
-ferror-limit 19 -fmessage-length 161 -stack-protector 1 -fblocks
-fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature
-fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option
-fcolor-diagnostics -o hello.o -x c++ hello.cc
clang -cc1 version 8.0.0 (clang-800.0.42) default target
x86_64-apple-darwin15.6.0
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/v1"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/local/include"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks
(framework directory)
End of search list.

which produces a valid c++ header search path of...

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 

compared llvm.org's clang compiler which mangles this path by prefixing an
additional instance of
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
before the valid path of
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
making it unusable.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>