Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

STL search path missing in self-compiled clang on OS X 10.10.5 #25043

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR25044
Status NEW
Importance P normal
Reported by Tobias Markmann (tm@ayena.de)
Reported on 2015-10-04 07:20:46 -0700
Last modified on 2015-10-09 15:25:41 -0700
Version trunk
Hardware Macintosh MacOS X
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
I'm trying to build current trunk of clang on OS X 10.10.5.

# clang++ --version
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

I'm building using the following commands:

cmake \
    -G "Ninja" \
    -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" \
    -DCMAKE_INSTALL_PREFIX:PATH="/Users/tobias/Development/llvm/llvm_prefix" \
    -DCMAKE_CXX_FLAGS:STRING="-DLLVM_ENABLE_DUMP" \
    ../llvm
ninja -j 4
ninja install

When building a minimal c++ example with the just installed clang compiler it
won't find the STL headers. They are usually located somewhere inside XCode.app.

> cat foo.cpp
#include <iostream>

int main() {
    return 0;
}
> clang++ -v -o foo foo.cpp
clang version 3.8.0 (http://llvm.org/git/clang.git
6a948411b24f78177db24b0b06acf2ca202b469d) (http://llvm.org/git/llvm.git
ea978bb5631cd8dce5af87a2678750936a90d40c)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
InstalledDir: /Users/tobias/Development/llvm/llvm_prefix/bin
 "/Users/tobias/Development/llvm/llvm_prefix/bin/clang-3.8" -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name foo.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.3.3 -v -dwarf-column-info -resource-dir /Users/tobias/Development/llvm/llvm_prefix/bin/../lib/clang/3.8.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/tobias/Development/swift/swift-mac -ferror-limit 19 -fmessage-length 238 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/jk/173vrmtn09n08c_8d_my9l400000gn/T/foo-d4f0b7.o -x c++ foo.cpp
clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target x86_64-apple-
darwin14.5.0
ignoring nonexistent directory
"/Users/tobias/Development/llvm/llvm_prefix/bin/../include/c++/v1"
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Users/tobias/Development/llvm/llvm_prefix/bin/../lib/clang/3.8.0/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
foo.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^
1 error generated.
Quuxplusone commented 9 years ago
With help of #llvm I could get it to work for me. As it turns out one
- either has to build with libcxx and install it in the same installation
directory as the rest goes
- or, symlink libc++ from XCode.app in the install dir.

It would be great if this would be mentioned in the documentation, because it
was not obvious; at least for me.