Install LLVM on CentOS-5

Here's some tips of installing LLVM, CLANG and LLVM-GCC on CentOS computer:

I download the newst version llvm (version 2.8), and so are clang and llvm-gcc, the installation mostly followed the instructions on the official website: http://llvm.org/docs/GCCFEBuildInstrs.html

I installed llvm first:

 

1) Unpack the compress file llvm-2.8.tgz and clang-2.8.tgz, put clang source file in llvm-2.8/tools, so clang will be build with llvm automatically, and create an new directory for stroring object files and an extra directory for installing binary files. That's to say:

MAKE_DIR: $SRC_PATH/configure --prefix=$INSTALL_DIR --disable-optimized ......

     MAKE_DIR: make; make install

 

2) The most difficult thing is building llvm-gcc.

firstly, I installed llvm-gcc from source code, just follow the steps above like installing llvm, remember to create an new directory for storing object files, while you can still use the old directory for installing binary files.But building failed, the errors are something like: force_align_functions_log undefined or void restore(void) used but undefined, and there are several other errors, so it seems building from source code is not gonna working.

secondly, I downloaded the binary file directly, setup is very easy: add llvm-gcc binary path to .bashrc and add set the LD_LIBRARY_PATH as "llvm-gcc/lib", but when I tested, error appeared: cann't find GLIBC_2.7. That means the llvm-gcc binary is built with a higher glibc version than the version on CentOS(which is version 2.5 actually), so I tried to update glibc by yum, but failed, and download glibc-2.7.tar.gz, while building from souce was also unsuccessful. Finally I found the reason, it seems I need to update the kernel, the followinig is cited from: http://www.held.org.il/blog/2008/03/glibc-27-on-centos-rhel-5/

"glibc 2.7 introduces a new flag to open() syscall, called O_CLOEXEC.The official redhat 2.6.18 kernel (even of version 5.1) doesn’t support it, and returns errors (in strace it looks like open() returns unknown error 530). So.. just try not to use glibc 2.7 on RedHat, until they support it. If you want an adventure,this kernel seems to do the job.. "

 

So, It seems I need to update the kernel or use a lower llvm version, but maybe there is a better solution which I stilled have no idea, expecting that cause the installation was not completed yet.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值