[cfe-dev] getting clang to find non-default libstdc++

Chandler Carruth chandlerc at google.com
Sun Apr 29 00:09:25 PDT 2012


On Sat, Apr 28, 2012 at 11:57 PM, Nathan Ridge <zeratul976 at hotmail.com>wrote:

>
> > > I am trying to use clang for the first time, on Ubuntu 10.04.
> > >
> > > The default compiler on Ubuntu 10.04 is GCC 4.4, but I've built
> > > GCC 4.7 from source and use it to compile C++11 programs.
> > >
> > > Clang finds GCC 4.4's libstdc++ no problem, but I need it to
> > > use GCC 4.7's libstdc++ because my program uses standard
> > > library features that have been added between GCC 4.4 and 4.7.
> > > How do I direct clang to find the 4.7 libstdc++?
> > >
> > > I saw the following instructions on the "Get Started" page:
> > >
> > > "If Clang cannot find your system libstdc++ headers, please
> > > follow these instructions:
> > >  - 'gcc -v -x c++ /dev/null -fsyntax-only' to get the
> > >    path.
> > >  - Look for the comment "FIXME: temporary hack:
> > >    hard-coded paths" in clang/lib/Frontend/InitHeaderSearch.cpp
> > >    and change the lines below to include that path"
> > >
> > > Is that the only way? Having to recompile the compiler to get
> > > it to find a different standard library seems a bit excessive...
> > > shouldn't one be able to switch standard libraries without
> > > recompiling the compiler?
> >
> > Those comments are a bit out of date for linux. You should be able to
> > configure clang with --with-gcc-toolchain pointing to where you
> > install g++ 4.7.
>
> Thanks! I think the webpage should be updated to reflect this.
> I attached a patch.
>

Can you mention that in general, Clang should automatically detect the best
version of libstdc++ headers available and use them, and that it will look
both for system installations of libstdc++ as well as installations
adjacent to clang itself?

The --with-gcc-toolchain should really be a fallback for when the
configuration is quite strange.


>
> Regards,
> Nate
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120429/a19bc41a/attachment.html>


More information about the cfe-dev mailing list