[cfe-dev] system search path for option -stdlib=libc++

Frank Rehwinkel frankrehwinkel at gmail.com
Fri Jan 31 15:25:51 PST 2014


Thanks for the pointer, and for having put this script onto github.

One question.  It puts the shared form of libc++ into <prefix>/lib but
clang++ still isn't being built to look in <prefix>/lib.  Your script is
adding a -L argument for this path to the third stage build so clang++ can
build clang with the library.  Your 'testit' script then goes ahead and
fails for me because it does not use the -L<prefix>/lib argument.  Does
this work for you on a Linux system?  If so, I wonder what is different for
mine.  Or maybe you only tried the testit script on Darwin?

I'll take another look at those diffs.  I didn't see any that tried to add
<prefix>/lib to the search path, but maybe I overlooked something.

Thanks,
-Frank


On Fri, Jan 31, 2014 at 1:27 PM, Robin Sommer <robin at icir.org> wrote:

> In case it helps, I'm maintaining a helper script that builds/installs
> a standalone llvm/clang/libc++ combo into a prefix of your choice.
> --stdlib=libc++ will "just work" with that.
>
> The script got updated to 3.4 recently:
>
>     https://github.com/rsmmr/install-clang
>
> The script patches the code a bit to get around search path problems,
> though I'm actually not sure if all the patches are still needed. It
> works on Linux and Darwin.
>
> Robin
>
> On Fri, Jan 31, 2014 at 10:08 -0500, Frank Rehwinkel wrote:
>
> > Hi,
> >
> >
> > I would like to compile and install llvm/clang/libcxx into a local
> > directory on Linux (Gentoo).  I haven't found the right combination of
> > cmake -D flags to make the -stdlib=c++ option work.
> >
> > The first part seems straightforward enough:
> >
> > cmake -G Ninja \
> >
> >     -DCMAKE_BUILD_TYPE=Release \
> >
> >     -DCMAKE_INSTALL_PREFIX=/local/llvm/3.4/usr \
> >
> >     -DFFI_INCLUDE_DIR=/usr/lib64/libffi-3.0.11/include \
> >
> >     -DFFI_LIBRARY_DIR=/usr/lib64 \
> >
> >     -DLLVM_BUILD_TESTS=ON \
> >
> >     -DLLVM_ENABLE_FFI=ON    \
> >
> >     -DLLVM_EXTERNAL_MSBUILD_BUILD=OFF   \
> >
> >     -DLLVM_TARGETS_TO_BUILD=host    \
> >
> >     -DPYTHON_EXECUTABLE=/usr/bin/python2    \
> >
> >     -DLIBCXX_CXX_ABI=libstdc++ \
> >
> >
> >
> -DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include/g++-v4;/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/include/g++-v4/x86_64-pc-linux-gnu"
> > \
> >
> >     -DLIBCXX_ENABLE_SHARED=YES \
> >
> >     ${SRC}
> >
> >
> > But the system header search path used by clang++ when the libc++ stdlib
> is
> > used then is completely wrong.  Looking through the source code, I
> stumbled
> > on the parameters DEFAULT_SYSROOT and gave that a try.
> >
> > -DDEFAULT_SYSROOT=/local/llvm/3.4
> >
> > and that made the system header search path look good as far as finding
> the
> > libc++ headers, but now the plain old /usr/include directory is no longer
> > in the search path so /usr/include/features.h is not found.
> >
> > Is building clang and libcxx on Linux and installing to a local directory
> > supported and if so, please, what did I overlook or not know?
> >
> > (I built with gcc, version 4.7.3 as you may have surmised by the paths
> > above.)
> >
> > Thanks,
> > -Frank
>
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
>
> --
> Robin Sommer * Phone +1 (510) 722-6541 *     robin at icir.org
> ICSI/LBNL    * Fax   +1 (510) 666-2956 * www.icir.org/robin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140131/fb4320d1/attachment.html>


More information about the cfe-dev mailing list