Getting Started: Building and Running Clang
来源:互联网 发布:c语言fprintf 编辑:程序博客网 时间:2024/06/05 00:38
Getting Started: Building and Running Clang
本页面为您提供最短路径检查Clang和演示几个例子。这应该能让最小的遇到麻烦和混乱来运行它。如何你得到了你想要的结果,请考虑参与Clang社团
Building Clang and Working with the Code
如果你要检查和编译Clang,具体步骤如下:
获得所需的工具
检查LLVM
检查Clang
检查附加的Clang工具:(可选)
cd llvm/tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
检查Compiler-RT
编译LLVM和Clang
mkdir build
cd build
../llvm/configure
make
这个同时建立了LLVM和Clang调试模式。
注意:为了之后Clang的发展,你也可以只在Clang目录下编译
它也可以使用CMake代替Makefiles
如果你打算用Clang的C++,你需要告诉如何寻找你的C++标准库头文件。通常,Clang将检测到的最好的版本libstdc++头文件的可用性和使用它们。看起来既为系统安装libstdc++以及安装Clang本身。如果您的配置不符合这些情况,你可以用--with-gcc-toolchain编译选项来告诉Clang gcc包含所需的libstdc++的安装位置
注意Clang前端使用LLVM,但是不是依靠llvm-gcc。如果你在编译Clang时遇到了问题,确保你用最新的LLVM SVN 版本.
LLVM包含有Clang以及Clang发展更新的支持库。
Simultaneously Building Clang and LLVM
一旦你检查了llvm源码树中的Clangm,它将和剩下的llvm一起编译。为了让LLVM和Clang同时编译我们只需要在 LLVM根目录运行make命令
注意:要让Clang在技术上是Subversion版本库中独立的的一部分。就像上面提到的,最新的Clang资源是和最新的LLVM资源绑在一起的。你可一用make update来升级LLVM项目和以及所有包含在LLVM(可能无关的)中的项目。这将在和subversion有关的所有子目录中运行 svn update。
Clang Compiler Driver (Drop-in Substitute for GCC)(替代GCC)
Clang工具编译驱动程序和前端,是设计用来替代gcc的。这里有一些例子,如何使用高级的编译器的。
$ cat t.c
#include <stdio.h>
int main(int argc, char **argv)
{ printf("hello world");}
$ clang t.c$ ./a.outhello world
Clang设计得最大可能的接近于GCC的工作方式。
只有两者的主要差别是,
Clang默认为gnu99模式而GCC默认gnu89模式。
如果你遇到了关于内联函数的连接错误,
在Clang中试试 -std=gnu89
- Getting Started: Building and Running Clang
- Running Mesos - Getting Started
- 网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch
- Getting Started-Building Your First App
- Building and Running
- Building and Running Modules
- TestComplete4 ->Getting Started and tips
- Building and Running Overview(官方)
- Building Clang and libc++ on Ubuntu Linux
- Getting Started with Eclipse and the SWT
- Getting Started With Ruby and Rails
- Getting Started With Node.js and mongoDB
- Getting Started with Eclipse and Counterclockwise
- Getting Started with Kinect and Processing
- Getting Started With IronRuby And RSpec
- Getting started with OpenCL and GPU Computing
- Getting started with GWT, Maven and Eclipse
- Getting Started with JPA and Eclipse
- java 转发和重定向
- RISC-V学习第一篇
- Getting Started with the LLVM System
- iOS应用内支付(IAP)详解
- 论文写作中常用工具和格式排版
- Getting Started: Building and Running Clang
- Mac下Appium环境搭建
- MOOC北京理工《C语言程序设计(上)》第8周第2题:寻找矩阵的鞍点
- react---学习笔记:使用create-react-app快速构建开发环境并创建项目
- 程序的机器级表示(二) 学会汇编~
- linux内核的编译(2.6.39.4)
- textarea换行
- ubuntu卸载多余的内核
- matlab中imwrite函数