vivek pandya via llvm-dev
2016-Jun-23 17:56 UTC
[llvm-dev] [cfe-dev] clang++ build from source is not able to find C++ headers
On Thu, Jun 23, 2016 at 7:36 PM, Tim Northover <t.p.northover at gmail.com> wrote:> On 23 June 2016 at 06:31, vivek pandya via cfe-dev > <cfe-dev at lists.llvm.org> wrote: > > I am running OS X, when I build clang++ from source and use it to compile > > .cpp files it fails as it is not able to find C++ header. I am not > building > > libc++ along with llvm and clang. > > When I'm not building with libcxx in-tree I find it easiest to just > symlink Xcode's libc++ headers into the build directory. Something > like "ln -s > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++ > build/include". >Thanks Tim, symlink to build include does not help because clang++ looks headers into build/lib/clang/3.9.0/include ( as per output of clang++ -v) but I symlink to /usr/local/include , that worked I hope there is nothing wrong in doing so. -Vivek> > > using -stdlib=libstdc++ solves problem partially but it fails when using > > C++11 threads, again it can't find <thread>, to get this work clang++ > should > > work with -stdlib=libc++ but it fails with previous error of not finding > C++ > > headers. > > Yes, the libstdc++ included with OS X is ancient (from GCC 4.2 I > think) and there only for compatibility reasons. It has virtually no > support for C++11, which LLVM needs. > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160623/70cdee0a/attachment.html>
Jonathan Roelofs via llvm-dev
2016-Jun-23 17:58 UTC
[llvm-dev] [cfe-dev] clang++ build from source is not able to find C++ headers
On 6/23/16 11:56 AM, vivek pandya via llvm-dev wrote:> > > On Thu, Jun 23, 2016 at 7:36 PM, Tim Northover <t.p.northover at gmail.com > <mailto:t.p.northover at gmail.com>> wrote: > > On 23 June 2016 at 06:31, vivek pandya via cfe-dev > <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote: > > I am running OS X, when I build clang++ from source and use it to compile > > .cpp files it fails as it is not able to find C++ header. I am not building > > libc++ along with llvm and clang. > > When I'm not building with libcxx in-tree I find it easiest to just > symlink Xcode's libc++ headers into the build directory. Something > like "ln -s > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++ > build/include". > > Thanks Tim, > > symlink to build include does not help because clang++ looks headers > into build/lib/clang/3.9.0/include ( as per output of clang++ -v) but IThat path is where clang is looking for compiler-provided headers. You should see another path in the -v output that says where it is looking for the c++ headers, which should not be in the same place. Jon> symlink to /usr/local/include , that worked I hope there is nothing > wrong in doing so. > > -Vivek > > > > using -stdlib=libstdc++ solves problem partially but it fails when using > > C++11 threads, again it can't find <thread>, to get this work clang++ should > > work with -stdlib=libc++ but it fails with previous error of not finding C++ > > headers. > > Yes, the libstdc++ included with OS X is ancient (from GCC 4.2 I > think) and there only for compatibility reasons. It has virtually no > support for C++11, which LLVM needs. > > Cheers. > > Tim. > > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Jon Roelofs jonathan at codesourcery.com CodeSourcery / Mentor Embedded
Cristianno Martins via llvm-dev
2016-Jun-23 18:15 UTC
[llvm-dev] [cfe-dev] clang++ build from source is not able to find C++ headers
Hi Vivek, you can also include these lines below to your ~/.bash_profile: LLVM_BUILD="/Developer/llvm/build" # Path to your build directory alias new-clang="$LLVM_BUILD/bin/clang -Wno-expansion-to-defined -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include" alias new-clang++="$LLVM_BUILD/bin/clang++ -Wno-expansion-to-defined -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++" where you only need to set LLVM_BUILD to where in you system you built llvm/clang. After that, invoke "source ~/.bash_profile" on the current terminal, or simply open a new terminal, and you'll be able to use new-clang and new-clang++, instead of clang and clang++, to invoke your newest compiled binary. -- Cristianno Martins PhD Student of Computer Science University of Campinas cmartins at ic.unicamp.br <cristiannomartins at hotmail.com> On Thu, Jun 23, 2016 at 2:58 PM, Jonathan Roelofs via llvm-dev < llvm-dev at lists.llvm.org> wrote:> > > On 6/23/16 11:56 AM, vivek pandya via llvm-dev wrote: > >> >> >> On Thu, Jun 23, 2016 at 7:36 PM, Tim Northover <t.p.northover at gmail.com >> <mailto:t.p.northover at gmail.com>> wrote: >> >> On 23 June 2016 at 06:31, vivek pandya via cfe-dev >> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote: >> > I am running OS X, when I build clang++ from source and use it to >> compile >> > .cpp files it fails as it is not able to find C++ header. I am not >> building >> > libc++ along with llvm and clang. >> >> When I'm not building with libcxx in-tree I find it easiest to just >> symlink Xcode's libc++ headers into the build directory. Something >> like "ln -s >> >> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++ >> build/include". >> >> Thanks Tim, >> >> symlink to build include does not help because clang++ looks headers >> into build/lib/clang/3.9.0/include ( as per output of clang++ -v) but I >> > > That path is where clang is looking for compiler-provided headers. You > should see another path in the -v output that says where it is looking for > the c++ headers, which should not be in the same place. > > > Jon > > symlink to /usr/local/include , that worked I hope there is nothing >> wrong in doing so. >> >> -Vivek >> >> >> > using -stdlib=libstdc++ solves problem partially but it fails when >> using >> > C++11 threads, again it can't find <thread>, to get this work >> clang++ should >> > work with -stdlib=libc++ but it fails with previous error of not >> finding C++ >> > headers. >> >> Yes, the libstdc++ included with OS X is ancient (from GCC 4.2 I >> think) and there only for compatibility reasons. It has virtually no >> support for C++11, which LLVM needs. >> >> Cheers. >> >> Tim. >> >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> > -- > Jon Roelofs > jonathan at codesourcery.com > CodeSourcery / Mentor Embedded > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160623/86e5c89e/attachment.html>
Seemingly Similar Threads
- [cfe-dev] clang++ build from source is not able to find C++ headers
- [cfe-dev] clang++ build from source is not able to find C++ headers
- cmake 3.7.0-rc1 breaks stage2 bootstrap in openmp on 10.11 with Xcode 8
- How to use mainline clang/llvm with CMake
- Clang8 on MacOS 10.14