Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.