redhat6.2 clang编译环境搭建(采用源码包编译安装)
1. About clang++
office site:http://clang.llvm.org/
A major focus of our work on clang is to make it fast, light and scalable. The library-based architecture of clang makes it straight-forward to time and profile the cost of each layer of the stack, and the driver has a number of options for performance analysis. Many detailed benchmarks can be found online.
2. System environment configuration
Getting Introduction from the office website:
Compiling LLVM requires that you have several software packages installed. The table below lists those required packages. The Package column is the usual name for the software package that LLVM depends on. The Version column provides “known to work” versions of the package. The Notes column describes how LLVM uses the package and provides other details.
Package | Version | Notes |
---|---|---|
GNU Make | 3.79, 3.79.1 | Makefile/build processor |
GCC | >=4.7.0 | C/C++ compiler1 |
python | >=2.5 | Automated test suite2 |
GNU M4 | 1.4 | Macro processor for configuration3 |
GNU Autoconf | 2.60 | Configuration script builder3 |
GNU Automake | 1.9.6 | aclocal macro generator3 |
libtool | 1.5.22 | Shared library manager3 |
zlib | >=1.2.3.4 | Compression library4 |
local System configuration analysis :
# /usr/bin/gcc4.4.5 --version
gcc4.4.5 (GCC) 4.4. (Red Hat 4.4.-) # python -V
Python 2.6. # make -v
GNU Make 3.81 # automake --version
automake (GNU automake) 1.11. # libtool --version
ltmain.sh (GNU libtool) 2.2.6b
Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>,
3. gcc upgrade
3.1 gmp,mpfr,mpc installation
wget https://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2
wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.gz
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.2.tar.gz
tar jxvf gmp-5.1..tar.bz2
tar zxvf mpfr-3.1..tar.gz
tar zxvf mpc-1.0..tar.gz cd gmp-5.1.
./configure --enable-cxx CPPFLAGS=-fexceptions
make; make install
cd ../mpfr-3.1.; ./configure
make; make install
cd ../mpc-1.0.; ./configure
make; make install
3.2 gcc upgrade
wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2
tar -xvjf gcc-4.8..tar.bz2
cd gcc-4.8.mkdir gcc-4.8.-build
cd gcc-4.8.-build
../configure --prefix=/usr/local/gcc-4.8.2 --enable-languages=c,c++
make make install
notice:change the links in /usr/lib & /usr/bin [only need make some softlinks to the directory, incase of pollute the original files . You can remove the softlinks while necessary which is not commentary ]
cd /usr/bin/
# mv gcc gcc4.4.5
# mv g++ g++4.4. ln -sf /usr/local/gcc-4.8./bin/gcc gcc
ln -sf /usr/local/gcc-4.8./bin/g++ g++
ln -sf /usr/local/gcc-4.8./lib64/libstdc++.so.6.0. /usr/lib64/libstdc++.so.
4. make building files
Change directory to where you want the llvm directory placed.
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
4.2 Checkout Clang:
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../..
4.3 Checkout extra Clang Tools: (optional)
cd llvm/tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
cd ../../../..
4.4 Checkout Compiler-RT:
cd llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
cd ../..
4.5 Build LLVM and Clang:
mkdir build (for building without polluting the source dir)
cd build
../configure --prefix=/usr/local/clang --enable-optimized
make
4.6 error resolved
checking for x86_64-unknown-linux-gnu-gcc... /data/installs/gcc-4.7./host-x86_64-unknown-linux-gnu/gcc/xgcc -B/data/installs/gcc-4.7./host-x86_64-unknown-linux-gnu/gcc/ -B/usr/local/gcc-4.7./x86_64-unknown-linux-gnu/bin/ -B/usr/local/gcc-4.7./x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gcc-4.7./x86_64-unknown-linux-gnu/include -isystem /usr/local/gcc-4.7./x86_64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in `/data/installs/gcc-4.7./x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[]: *** [configure-stage1-target-libgcc] Error
make[]: Leaving directory `/data/installs/gcc-4.7.'
make[]: *** [stage1-bubble] Error
make[]: Leaving directory `/data/installs/gcc-4.7.'
make: *** [all] Error
resolution: due to the official document, the gcc-4.7.4 can not work normally with the clang++ , which been improved to be a bug
resolution:
5. clang environment test
root@192.168.100.252:/data/forilen# cat t.c
#include <stdio.h>
int main(int argc, char **argv) { printf("hello world\n"); }
root@192.168.100.252:/data/forilen# clang t.c
root@192.168.100.252:/data/forilen# ls
a.out for.sh gerritDir git scripts t.c
root@192.168.100.252:/data/forilen# ./a.out
hello world
6. References
[1]. gcc upgrade: http://my.oschina.net/vaero/blog/210485
[2]. gcc download: http://gcc.parentingamerica.com/releases/ https://gcc.gnu.org/mirrors.html
[3]. clang installation: http://clang.llvm.org/get_started.html#build
[4]. python Introduction: http://blog.csdn.net/pan_tian/article/details/7684409
redhat6.2 clang编译环境搭建(采用源码包编译安装)的更多相关文章
- LAMP 环境搭建之源码包编译安装
mysql用的二进制包安装. Apache php 用的源码包 mysql版本5.5.46 Apache版本2.4.7 PHP版本:5.5 mysql安装部分参考了阿铭linux的内容. 这是 ...
- Emscripten编译环境搭建--将C和C++编译成JS
Emscripten编译环境搭建--将C和C++编译成JS 需求:linux环境下用js执行c.c++文件,使用emscirpten编译器 目标:搭建好Emscripten环境 环境:Ubuntu16 ...
- MySQL源码包编译安装
+++++++++++++++++++++++++++++++++++++++++++标题:MySQL数据库实力部署时间:2019年3月9日内容:MySQL源码包进行编译,然后部署MySQL单实例重点 ...
- CentOS 7.2使用源码包编译安装MySQL 5.7.22及一些操作
CentOS 7.2使用源码包编译安装MySQL 5.7.22及一些操作 2018年07月05日 00:28:38 String峰峰 阅读数:2614 使用yum安装的MySQL一般版本比较旧,但 ...
- 编译最新版webrtc源码和编译好的整个项目10多个G【分享】
编译最新版webrtc源码和编译好的整个项目10多个G[分享] 参考https://webrtc.org/native-code/development/编译最新版webrtc源码: Git clon ...
- zabbix 3.2.2 server端(源码包)安装部署 (一)【转】
环境准备: 操作系统 CentOS 6.8 2.6.32-642.11.1.el6.x86_64 zabbix server 172.16.10.150 zabbix agent 172.16.10. ...
- Linux——【rpm、yun、源码包】安装
RPM包或者安装源码包 在windows下安装一个软件很轻松,只要双击.exe的文件,安装提示连续“下一步”即可,然而linux系统下安装一个软件似乎并不那么轻松,因为我们不是在图形界面下.所以我们要 ...
- Linux学习笔记15—RPM包的安装OR源码包的安装
RPM安装命令1. 安装一个rpm包rpm –ivh 包名“-i” : 安装的意思“-v” : 可视化“-h” : 显示安装进度另外在安装一个rpm包时常用的附带参数有:--force : 强制安装, ...
- 源码包的安装、rsync同步、inotify监测
一.源码包的安装 1.源码包的作用:yum 使用的是rpm包,rpm包安装的不能指定安装位置 源码包可以按需选择/定制,及时修复bug ,适用于各种平台 2.大致过程:源码包——>make gc ...
随机推荐
- Global Times 单词(日常收集)
1. 2013-09-09 windfall 英[ˈwɪndfɔ:l] 美[ˈwɪndˌfɔl] n.意外之财:被风吹落的果子:意外的收获 eg:Only half made any attempt ...
- this详解与面向对象编程
原文链接:http://www.cnblogs.com/kongxy/p/4581223.html JS中的this对象详解 声明:文章转载自上面地址,版权归阿孔所有,这里仅供本人学习笔记使用 t ...
- Java之Undeclared Checked Exception
之前一直认为在Java里如果每个task是相对独立.并且是可以容忍错误的,那么只需要处理Checked Exception(这个是Java强制的)和主动处理Unchecked Exception(派生 ...
- 【微信公众号】微信关于网页授权access_token和普通access_token的区别及两种不同方式授权
微信官网网址:https://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html#.E9.99.84.EF.BC.9A.E6. ...
- 配置tomcat的session共享
可通过下面方法限制一个用户访问一个服务器之后就只在该服务器上操作. 请求负载过程中会话信息不能丢失.那么在多个tomcat中session需要共享. 配置tomcat的session共享可以有三种解决 ...
- 流媒体协议RTMP,RTSP与HLS有什么不同
转载自:http://www.cuplayer.com/player/PlayerCode/Wowza/2015/0204/1774.html HLS (HTTP Live Streaming) Ap ...
- 从程序员到CTO的Java技术路线图 JAVA职业规划 JAVA职业发展路线图 系统后台框架图、前端工程师技能图 B2C电子商务基础系统架构解析
http://zz563143188.iteye.com/blog/1877266在技术方面无论我们怎么学习,总感觉需要提升自已不知道自己处于什么水平了.但如果有清晰的指示图供参考还是非常不错的,这样 ...
- 在Cocos2d-X中使用xml
XML就可以扩展标记语言.在游戏开发中,经常使用于保存游戏信息,如最高分,游戏等级.等信息,和描写叙述一些资源等,我第一次使用xml是在使用CCAnimation创建动画中,使用plist文件载入动画 ...
- cxf动态调用webservice设置超时,测试线程安全
Java代码 import java.util.Random; import java.util.concurrent.ArrayBlockingQueue; import java.util.con ...
- bazel-编译多目标
demo2 使用bazel编译多目标示例,一个bianry,一个library. demo2目录树 ── demo2 ├── app │ ├── BUILD │ ├── func.cpp ...