[LLVMdev] question on clang c++ support

Christine Cheng clcheng at stanford.edu
Wed Sep 21 15:40:57 PDT 2011


Hi,

I am new to linux, llvm and clang, so please excuse me if I ask some basic
level questions. :)

I have some c code with code like below, so it won't compile with clang
#include <math.h>
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdlib.h>
#include <malloc.h>
#include <sched.h>

I think that I need to do the following from the website:

If you intend to work on Clang C++ support, you may need to tell it how to
find your C++ standard library headers. 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.

After I run 'gcc -v -x c++ /dev/null -fsyntax-only' at the terminal, the
following error came up:
-------------------

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=i386-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/i386-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/i386-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold
--enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc
--enable-targets=all --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=i686-linux-gnu
--host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
COLLECT_GCC_OPTIONS='-v' '-fsyntax-only' '-mtune=generic' '-march=i686'
 cc1plus -quiet -v -D_GNU_SOURCE /dev/null -D_FORTIFY_SOURCE=2 -quiet
-dumpbase null -mtune=generic -march=i686 -auxbase null -version
-fsyntax-only -o /dev/null -fstack-protector
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
-------------------

After some googling, it seems that I need to install g++ which has the same
version as the gcc, is it the right solution?

Thanks,

Christine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110921/47b85eac/attachment.html>


More information about the llvm-dev mailing list