5

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?

1 Answers1

3

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 :)

Paweł Prażak
  • 287
  • 2
  • 11