Centos – llvm and clang on CentOS 5 without root permissions

centosglibcllvm

I am trying to have llvm and clang on a centOS 5 without root permissions.
I tried to do it downloading llvm and clang src packages and trying the ususal configure, make and make install steps as such:

wget http://llvm.org/releases/3.3/llvm-3.3.src.tar.gz
wget http://llvm.org/releases/3.3/cfe-3.3.src.tar.gz
tar xzf llvm-3.3.src.tar.gz && cd llvm-3.3.src/tools/ && tar xzf ../../cfe-3.3.src.tar.gz

I tried with a newer version of gcc compiled for this 64bit CentOS system, because the older version wouldn't work (see below). When I try it with the newer version, I get this:

export LD_LIBRARY_PATH=/home/avilella/src/gcc/gcc-4.7.2/lib64:/home/avilella/src/gcc/gcc-4.7.2/lib
export CC=/home/avilella/src/gcc/gcc-4.7.2/bin/gcc
export CXX=/home/avilella/src/gcc/gcc-4.7.2/bin/g++  
export PATH=/home/avilella/src/python/python-2.7.3/bin:$PATH
cd ~/src/llvm/latest/llvm-3.3.src
./configure --prefix=/home/avilella/src/llvm/latest/llvm && make clean && make -j8 && make install

After these steps, I don't see clang in the bin directory:

/home/avilella/src/llvm/latest/llvm/bin    

So I followed the instructions in the clang directory, and ran make -j8 on it:

cd ~/src/llvm/latest/llvm-3.3.src/tools/cfe-3.3.src
make -j8

Doing so, I get this clange/Config/config.h error:

[...]
InitHeaderSearch.cpp:17:51: fatal error: clang/Config/config.h: No such file or directory
[...]

This is mentioned in a bug report from 2011, which I would be solved by now:

http://llvm.org/bugs/show_bug.cgi?id=11903

Any ideas?


PREVIOUS ATTEMPTS:

cd ~/src/llvm/latest/llvm-3.3.src
./configure --prefix=/home/avilella/src/llvm/latest/llvm && make clean && make -j8 && make install

checking for clang... clang
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

Some of the contents of config.log:

configure:2047: checking for clang
configure:2063: found /home/avilella/bin/clang
configure:2074: result: clang
configure:2110: checking for C compiler version
configure:2117: clang --version >&5
clang: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by clang)
clang: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by clang)
clang: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by clang)
clang: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by clang)
clang: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by clang)
[...]

I tried to use the fedora18 binary versions available on the llvm website, but it complains about a GLIBC version that cannot be found in the system:

[~/src/llvm/clang+llvm-3.3-x86_64-fedora18/bin] $ ./clang
./clang: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by ./clang)
./clang: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./clang)

I've got more recent version of gcc on this system, but I am guessing I need to either download binaries or recompile versions of libc to have this working. The question is how.

I tried downloading rpms from here:

http://pkgs.org/centos-5-rhel-5/centos-rhel-updates-x86_64/glibc-2.5-107.el5_9.5.x86_64.rpm/download/

I placed the contents of the rpm into a folder:

rpm2cpio $rpm | cpio -idmv

and added that folder lib64 into my LD_LIBRARY_PATH env variable, but that didn't solve the problem either (and made simple command like ls and less crash):

clang: /home/avilella/src/llvm/glibc/lib64/libc.so.6: version `GLIBC_2.15' not found (required by clang)
clang: /home/avilella/src/llvm/glibc/lib64/libc.so.6: version `GLIBC_2.14' not found (required by clang)

Best Answer

I was able to build clang by following a modified version of steps you took.

# Preliminary:
#  Get source
#  Extract source
#  Set environmental variables

cd /home/avilella/src/llvm/latest
# Clang is expected to be at `tools/clang`.
mv tools/cfe-3.3.src tools/clang
# You should clean before configuring, not after.
make clean
# The missing config.h file is created by the configure script
#  if clang is in the correct location 
./configure --prefix=/home/avilella/src/llvm/latest/llvm
make -j8
make install
Related Question