[cfe-dev] Building LLVM+Clang with Clang+libc++

Marc J. Driftmeyer mjd at reanimality.com
Tue Aug 2 19:19:12 PDT 2011


FWIW I decided to test your scenario under Debian Sid:

Here are the knowns:

   1. I have clang/clang++ installed under /usr/local/bin
   2. I have cmake built libc++ installed under /usr/local/include/c++/v1
   3. I built the prior build for libc++ outside of trunk under my
      LLVMProject path
   4. I have ~/DeveloperProjects/LLVMProjects/trunk/llvm,
      ~/DeveloperProjects/LLVMProjects/trunk/llvm/projects/llvm-test/
      and ~/DeveloperProjects/LLVMProjects/trun/llvm/toosl/clang followed by
   5. ~/DeveloperProjects/LLVMProjects/libc++ outside of the trunk tree
   6. I build LLVM/Clang trunk with standard automake tools
   7. I build libc++ with cmake separately
   8. System CPU Architecture is just a Pentium D 945 on this build box.
   9. I run $ make -j3 (n+1 cores)
  10. If it fails to fully build just run *make* -j(n+1) until the
      sections waiting on prior built portions are built

New Scenario includes your request to build LLVM/Clang/Clang++ against 
libc++

Configuration trick to get it to build my set up is as follow:

   $ _*../trunk/llvm/configure &&*_ ../trunk/llvm/configure 
--enable-target=x86_64,arm,cpp,cbe --with-clang=/usr/local/bin/clang 
--with-built-clang --enable-pic --enable-polly --enable-shared 
--with-cxx-include-arch=x86_64 --enable-optimized 
--with-optimize-option=-O2 --enable-assertions --disable-bootstrap 
--disable-multilib --enable-jit --enable-threads --no-create 
--no-recursion *CXX='/usr/local/bin/clang++' CXXFLAGS='-stdlib=libc++ 
-I/usr/local/include/c++/v1'*

What's in *bold* is my updated configure set up to include your 
scenario. What's in _*bold*_ is the trick to get automake to make the 
config.status prepped to build against clang.

Build results:

...
llvm[2]: Linking Release+Asserts unit test ADT (without symbols)
llvm[2]: ======= Finished Linking Release+Asserts Unit test ADT (without 
symbols)
make[2]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/unittests/ADT'
make[1]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/unittests'
make[1]: Entering directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects'
make[2]: Entering directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample'
make[3]: Entering directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/lib'
make[4]: Entering directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/lib/sample'
llvm[4]: Compiling sample.c for Release+Asserts build
llvm[4]: Building Release+Asserts Archive Library libsample.a
make[4]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/lib/sample'
make[3]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/lib'
make[3]: Entering directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/tools'
make[4]: Entering directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/tools/sample'
llvm[4]: Compiling main.c for Release+Asserts build
llvm[4]: Linking Release+Asserts executable Sample (without symbols)
llvm[4]: ======= Finished Linking Release+Asserts Executable Sample 
(without symbols)
make[4]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/tools/sample'
make[3]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample/tools'
make[2]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects/sample'
make[1]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/projects'
make[1]: Entering directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/bindings'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory 
`/home/mdriftmeyer/DeveloperProjects/LLVMProject/build-llvm-clang-libc++/bindings'
llvm[0]: ***** Completed Release+Asserts Build
mdriftmeyer at horus:~/DeveloperProjects/LLVMProject/build-llvm-clang-libc++$

*SUCCESS!*


Final Conclusion:

I'll continue to stagger the build of trunk and update libc++ and 
rebuild trunk for the time being until LLVM/Clang's Hinnant recommends 
moving it under the llvm trunk branch directly.

Sincerely Yours,

Marc J. Driftmeyer

On 08/02/2011 12:14 AM, David Blaikie wrote:
> I'm attempting to selfhost clang (&  libc++)&  running into what I
> assume are some fairly simple problems (on Ubuntu linux - after using
> symlinks to work around some weird binary/include placement in
> Ubuntu). Running the following configure command:
>
>      ../../../../llvm/configure --enable-optimized --disable-assertions
> --prefix=/home/dblaikie/Development/llvm/clean/install/x86-32/Release/llvm
> --with-built-clang CXXFLAGS=-stdlib=libc++
>
> I have previously configured this same path without clang (same
> command, bar the last two arguments), built, installed, and built
> libc++ from that installed build (libc++ is 'installed' as per the
> recommendations - symlinking into the system paths, so it should be
> accessible. My simple command line experiments seem to confirm this).
>
> My intent is to reconfigure as above, rebuild, reinstall, rebuild
> libc++, and at that point I should be fully self hosting on a clang
> build built with clang/libc++.
>
> When I run the above configure command, I get the attached config.log.
> The final few lines of output are:
>
> configure:13392: checking LLVM capable compiler
> configure:13410: result: clang
> configure:13415: checking tool compatibility
> configure:13438: error: g++|clang++|icc required but not found
>
> Looking at the configure script itself I'm having difficulty
> understanding how it checks for clang. The if check that is failing&
> printing this error checks only GXX and IXX, nothing clang related,
> but I assume somewhere along the way the clang&  gcc paths are merged
> given clang's drop-in-replacement-for-gcc design, but I can't find
> that point.
>
> Any pointers to documentation on how to do this would be great.
>
> Thanks,
> - David
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
Marc J. Driftmeyer
Email :: mjd at reanimality.com <mailto:mjd at reanimality.com>
Web :: http://www.reanimality.com
Cell :: (509) 435-5212
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110802/694d5e0e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mjd.vcf
Type: text/x-vcard
Size: 317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110802/694d5e0e/attachment.vcf>


More information about the cfe-dev mailing list