Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed clang via yum:

yum install clang

Unfortunately, even a simple "Hello World!" won't compile because it tries to use the headers of libstdc++4.6 (which I think have c++0x features that clang does not understand). I could not find a libstdc++4.5 package, only for F14 which obviously didn't install.

I even tried installing the 2.9 binaries and also compiled&installed the svn trunk for myself. None of this helped.

I recall having the same problem on ubuntu, but I was able to solve it there by installing libstdc++4.5 headers.

So, how do people use clang on Fedora?

share|improve this question
up vote 3 down vote accepted

As you know there is a bug and bug in llvm for libstdc++4.6. I just compiled llvm with clang from trunk, according to this instructions

You have to configure include paths, I used this command to configure and compile it on F15 x86_64:

../llvm/configure \
  --enable-optimized \
  --disable-assertions \
  --enable-jit \
  --enable-libffi \
  --enable-shared \
  --with-c-include-dirs=/usr/include:$(find /usr/lib/gcc/*/* \
        -maxdepth 0 -type d)/include \
  --with-cxx-include-32bit-dir=32 \
  --with-cxx-include-root=$(find /usr/include/c++/* -maxdepth 0 -type d) \
  --with-cxx-include-arch=x86_64-redhat-linux

make -j3
sudo make install

Than I was able to compile hello world

#include <iostream>

int main() {
  std::cout << "Hello, World!\n";
  return 0;
}

with

clang -o hello hello.cpp -lstdc++

$ ./hello 
Hello, World!

This docs might be of interest as well.

I suppose there is an alternative to use libc++, but I haven't tried it myself.

Fedora llvm 2.9 binaries won't work because of some mesa dependencies on 2.8.

Hope this helps :)

share|improve this answer
    
Yes, the first bug was reported by me :). I also compiled trunk, but I didn't know I had to configure paths. I looked at libc++, but at the moment it looks like it's only for OSX (I think it's distributed with a binary dependency which is OSX-only). I left Fedora for the time being, because I really needed clang (actually clang_complete for vim). Thanks for the insight. – Tamás Szelei Sep 2 '11 at 11:40
    
Glad it solved your question :) Thanks for the update about libc++. – Paweł Prażak Sep 2 '11 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .