[cfe-dev] Building clang on Mavericks with libc++....

Fons Rademakers Fons.Rademakers at cern.ch
Fri Nov 8 16:00:39 PST 2013


Hi,

  when compiling clang (todays trunk) from source on Mavericks, which ships 
with libc++ in:

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

and for LLVM configured like this:

$ /Users/rdm/root/interpreter/llvm/src/configure 
--prefix=/Users/rdm/root/interpreter/llvm/inst --disable-docs 
--disable-bindings --disable-visibility-inlines-hidden --enable-libcpp 
--disable-optimized --enable-targets=host --with-extra-options= CC=clang 
CXX=clang++ CFLAGS=-m64 CXXFLAGS=-m64

but that does not seem to be enough as the built clang++ does look for 
libc++ in:

$ echo | ./interpreter/llvm/inst/bin/clang++ -E -v -x c++ -
clang version 3.4
Target: x86_64-apple-darwin13.0.0
Thread model: posix
  "/Users/rdm/root/interpreter/llvm/inst/bin/clang" -cc1 -triple 
x86_64-apple-macosx10.9.0 -E -disable-free -main-file-name - 
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose 
-munwind-tables -target-cpu core2 -target-linker-version 224.1 -v 
-resource-dir /Users/rdm/root/interpreter/llvm/inst/bin/../lib/clang/3.4 
-stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/rdm/root 
-ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign 
-fblocks -fobjc-runtime=macosx-10.9.0 -fobjc-dispatch-method=mixed 
-fobjc-default-synthesize-properties -fencode-extended-block-signature 
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics 
-vectorize-slp -o - -x c++ -
clang -cc1 version 3.4 based upon LLVM 3.4svn default target 
x86_64-apple-darwin13.0.0
ignoring nonexistent directory 
"/Users/rdm/root/interpreter/llvm/inst/bin/../lib/c++/v1"
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
  /usr/local/include
  /Users/rdm/root/interpreter/llvm/inst/bin/../lib/clang/3.4/include
  /usr/include
  /System/Library/Frameworks (framework directory)
  /Library/Frameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 171 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

so what config option should I specify to get clang++ to use the one and 
only copy of libc++, namely the one in:

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

Should configure not take the libc++ location from the specified CXX 
compiler? Which indeed is:

$ echo | clang++ -E -v -x c++ -Apple LLVM version 5.0 (clang-500.2.79) 
(based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
 
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" 
-cc1 -triple x86_64-apple-macosx10.9.0 -E -disable-free 
-disable-llvm-verifier -main-file-name - -mrelocation-model pic -pic-level 
2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 
-target-linker-version 224.1 -v -resource-dir 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0 
-stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/rdm/root 
-ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign 
-fblocks -fobjc-runtime=macosx-10.9.0 -fobjc-dispatch-method=mixed 
-fobjc-default-synthesize-properties -fencode-extended-block-signature 
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics 
-o - -x c++ -
clang -cc1 version 5.0 based upon LLVM 3.3svn default target 
x86_64-apple-darwin13.0.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.0/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.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 167 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2


Any suggestions welcome.


Cheers, Fons.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers at cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4161 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131109/7f59eea2/attachment.bin>


More information about the cfe-dev mailing list