Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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)
share|improve this question
    
I followed the steps in your question and got the same error regarding clang/Config/config.h. I'm looking for a fix now. –  Evan Teitelman Jul 6 '13 at 21:15
add comment

2 Answers

up vote 3 down vote accepted
+300

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
share|improve this answer
add comment

Generally it's not a good idea to simply unpack an RPM and try to use it's content because:

  1. you have to resolve the dependencies

  2. you lose the so called RPM scripts, which might be vital for proper functioning

  3. you lose the original directory structure, which might be vital for proper functioning

Number 2 and 3, are in fact rarely a problem (only happens when the RPM package is poorly prepared), but in this case your issue is the 1st one... It appears that glibc-common= 2.5-107.el5_9.5 is a dependency for example...

But anyhow, this approach that you have chosen is rather unfortunate... If you need a new compiler on a server where you don't have root access you can simply compile it from source and install it into an arbitrary directory. Start by taking a look at the clang Getting Started page. And make sure when you call configure you use the --prefix=/path_to/my_favorite_directory.

share|improve this answer
add comment

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.