<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>Does someone have a working shell script that builds and installs clang and libc++ on linux using gcc?</div><div><br></div><div>I’ve been trying to follow the instructions at <a href="http://libcxx.llvm.org">http://libcxx.llvm.org</a> to build on linux, where it says</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><p style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; line-height: 19px;">The following instructions are for building libc++ on FreeBSD, Linux, or Mac using <a href="http://libcxxabi.llvm.org/">libc++abi</a> as the C++ ABI library. On Linux, it is also possible to use <a href="http://libcxx.llvm.org/#libsupcxx">libsupc++</a> or <a href="http://libcxx.llvm.org/#libcxxrt">libcxxrt</a>.</p><p style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; line-height: 19px;">In-tree build:</p></div></blockquote><div><ul style="padding-left: 1.5em; color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; line-height: 19px;"><ul><li style="padding-bottom: 0.5em;">Check out libcxx and <a href="http://libcxxabi.llvm.org/">libcxxabi</a> into llvm/projects</li><li style="padding-bottom: 0.5em;"><code>cd llvm</code></li><li style="padding-bottom: 0.5em;"><code>mkdir build && cd build</code></li><li style="padding-bottom: 0.5em;"><code>cmake .. # Linux may require -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++</code></li><li style="padding-bottom: 0.5em;"><code>make cxx</code></li></ul></ul><div>I can’t tell what libsupc++ or libcxxrt are for from these pages, so I’m ignoring that.</div></div><div><br></div><div>I take it that the above instructions assume that I have already built clang. Right? It doesn’t say so.</div><div><br></div><div>Here’s an example of an attempt:</div><div><br></div><div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">0 Tue 0:56:53 yost <span style="color: #38bdca">s6</span> /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">568 Z% <span style="color: rgb(255, 255, 255);">ls -l projects</span></div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">total 12</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-rw-r--r--. 1 yost mill 999 Feb 27 2014 CMakeLists.txt</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">lrwxrwxrwx. 1 yost mill 27 Nov 24 15:10 compiler-rt -> ../../compiler-rt-3.5.0.src</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">lrwxrwxrwx. 1 yost mill 22 Nov 24 15:10 libcxx -> ../../libcxx-3.5.0.src</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">lrwxrwxrwx. 1 yost mill 25 Nov 24 15:10 libcxxabi -> ../../libcxxabi-3.5.0.src</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-rw-r--r--. 1 yost mill 664 Dec 12 2011 LLVMBuild.txt</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-rw-r--r--. 1 yost mill 1013 Mar 12 2014 Makefile</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">0 Tue 0:56:54 yost <span style="color: #38bdca">s6</span> /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"><span style="color: #ffcf82">569 Z% </span>mkdir build ; cd build</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">0 Tue 0:56:59 yost <span style="color: #38bdca">s6</span> /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"><span style="color: #ffcf82">570 Z% </span>cmake ..</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- The C compiler identification is GNU 4.4.7</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- The CXX compiler identification is GNU 4.4.7</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Check for working C compiler: /usr/bin/cc</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Check for working C compiler: /usr/bin/cc -- works</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Detecting C compiler ABI info</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Detecting C compiler ABI info - done</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Check for working CXX compiler: /usr/bin/c++</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Check for working CXX compiler: /usr/bin/c++ -- works</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">...</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">CMake Error at cmake/modules/HandleLLVMOptions.cmake:13 (message):</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"> Host GCC version must be at least 4.7!</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">Call Stack (most recent call first):</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"> CMakeLists.txt:315 (include)</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17); min-height: 12px;"><br></div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17); min-height: 12px;"><br></div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Configuring incomplete, errors occurred!</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">See also "/usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build/CMakeFiles/CMakeOutput.log".</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">See also "/usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build/CMakeFiles/CMakeError.log".</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">1 Tue 0:57:10 yost <span style="color: #38bdca">s6</span> /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"><span style="color: #ffcf82">571 Z% </span>which g++</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">/usr/local/gcc/4.8.2/bin/g++</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">0 Tue 0:57:26 yost <span style="color: #38bdca">s6</span> /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">572 Z% </div></div><div><br></div><div>It seems that cmake doesn’t bother to look in my PATH, so I try saying exactly where to find clang.</div><div><br></div><div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">0 Tue 1:00:18 yost <span style="color: #38bdca">s6</span> /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"><span style="color: #ffcf82">815 Z% </span>cmake -DCMAKE_C_COMPILER=/usr/local/llvm/3.5.0/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/llvm/3.5.0/bin/clang++ ..</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Target triple: x86_64-unknown-linux-gnu</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Native target architecture is X86</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Threads enabled.</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Doxygen disabled.</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Sphinx disabled.</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">CMake Error at cmake/modules/HandleLLVMOptions.cmake:13 (message):</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"> Host GCC version must be at least 4.7!</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">Call Stack (most recent call first):</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);"> CMakeLists.txt:315 (include)</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17); min-height: 12px;"><br></div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17); min-height: 12px;"><br></div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Configuring incomplete, errors occurred!</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">See also "/usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build/CMakeFiles/CMakeOutput.log".</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">See also "/usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build/CMakeFiles/CMakeError.log".</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">You have changed variables that require your cache to be deleted.</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">Configure will be re-run and you may have to reset some variables.</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">The following variables have changed:</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">CMAKE_C_COMPILER= /usr/local/llvm/3.5.0/bin/clang</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">CMAKE_CXX_COMPILER= /usr/local/llvm/3.5.0/bin/clang++</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17); min-height: 12px;"><br></div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Generating done</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 255, 255); background-color: rgb(5, 13, 17);">-- Build files have been written to: /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">1 Tue 1:00:49 yost <span style="color: #38bdca">s6</span> /usr/local/modulebuild/llvm/3.5.0..libc++/build/llvm-3.5.0.src/build</div><div style="margin: 0px; font-size: 9px; font-family: Monaco; color: rgb(255, 207, 130); background-color: rgb(5, 13, 17);">816 Z% </div></div><div><br></div><div>Still it seems to be looking for gcc in /usr/bin/. Why?</div><div><br></div><div>I am on a CentOS system, with old versions of tools in /usr and /usr/bin. Everything I build with has to come from PATH, etc.</div><div><br></div><div>Thanks</div></body></html>