[PATCH] Add clang headers that fix machine-dependent definitions on FreeBSD 9.2

Tobias M tmarkmann at googlemail.com
Tue Jul 15 12:32:20 PDT 2014


This commit seems to break compilation with clang on Mac OS X. 

My environment:
Mac OS X 10.9.4
CMake 3.0.0
clang/llvm/libcxx/extras all trunk

Build using:

```
cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="/Users/tobias/llvm" -DCMAKE_CXX_FLAGS:STRING="-DLLVM_ENABLE_DUMP" LLVM_BUILD_DOCS:BOOL=ON ../llvm
ninja 
ninja install
```

Test case:

```
#include <vector>

int main() { return 0; }

```
Test build (using clang trunk, preprocessed code https://dl.dropboxusercontent.com/u/14672346/tmp/clang-include-test_trunk.s ):

```
tobias at ruediger(2) /tmp> ~/llvm/bin/clang++ -v -o clang-include-test clang-include-text.cpp 
clang version 3.5.0 
Target: x86_64-apple-darwin13.3.0
Thread model: posix
 "/Users/tobias/llvm/bin/clang-3.5" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name clang-include-text.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -v -dwarf-column-info -resource-dir /Users/tobias/llvm/bin/../lib/clang/3.5.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /private/tmp -ferror-limit 19 -fmessage-length 204 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/qm/7pz79pjd5gg0h1w3dny4yl540000gn/T/clang-include-text-f12daf.o -x c++ clang-include-text.cpp
clang -cc1 version 3.5.0 based upon LLVM 3.5.0svn default target x86_64-apple-darwin13.3.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /Users/tobias/llvm/bin/../include/c++/v1
 /usr/local/include
 /Users/tobias/llvm/bin/../lib/clang/3.5.0/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
In file included from clang-include-text.cpp:1:
In file included from /Users/tobias/llvm/bin/../include/c++/v1/vector:265:
In file included from /Users/tobias/llvm/bin/../include/c++/v1/__bit_reference:15:
In file included from /Users/tobias/llvm/bin/../include/c++/v1/algorithm:628:
In file included from /Users/tobias/llvm/bin/../include/c++/v1/memory:604:
In file included from /Users/tobias/llvm/bin/../include/c++/v1/iterator:335:
In file included from /Users/tobias/llvm/bin/../include/c++/v1/iosfwd:90:
In file included from /usr/include/wchar.h:92:
In file included from /usr/include/_wctype.h:47:
/usr/include/_types/_wctype_t.h:31:9: error: unknown type name '__darwin_wctype_t'
typedef __darwin_wctype_t wctype_t;
        ^
1 error generated.

```
Test build (using system clang, preprocessed code https://dl.dropboxusercontent.com/u/14672346/tmp/clang-include-test_system.s ):

```
tobias at ruediger(2) /tmp> clang++ -v -o clang-include-test clang-include-text.cpp 
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name clang-include-text.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /private/tmp -ferror-limit 19 -fmessage-length 204 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/qm/7pz79pjd5gg0h1w3dny4yl540000gn/T/clang-include-text-04db85.o -x c++ clang-include-text.cpp
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin13.3.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o clang-include-test /var/folders/qm/7pz79pjd5gg0h1w3dny4yl540000gn/T/clang-include-text-04db85.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a

```

Just search for __darwin_wctype_t in the preprocessed code. It's defined for system clang but not for clang trunk.

http://reviews.llvm.org/D3908






More information about the llvm-commits mailing list