install-clang
=============
This script installs self-contained standalone 6.0 versions of [clang][1],
[LLVM][2], [libc++][3], [compiler-rt][4], [libc++abi][5], [lldb][6],
and [lld][7], on macOS and Linux, including linking clang and LLVM
against libc++ themselves as well. The script keeps all of the
installation within a given target prefix (e.g., `/opt/llvm`), and
hence separate from any already installed compilers, libraries, and
include files. In particular, you can later uninstall everything
easily by just deleting, e.g., `/opt/llvm`. Furthermore, as long as
the prefix path is writable, the installation doesn't need root
privileges.
If you have used older version of this script before, see News below
for changes.
Usage
-----
To see the available options, use `-h`:
> ./install-clang -h
Usage: install-clang [<options>] <install-prefix>
Available options:
-A enables assertions in LLVM libraries
-b build type (Release, Debug, RelWithDebInfo) [default: RelWithDebInfo]
-c skip cloning repositories, assume they are in place
-h|-? display this help
-j <n> build with <n> threads in parallel [default: 1]
-m use git/master instead of preconfigured versions
-s <stage> begin build from <stage> [0, 1, 2]
-u update an existing build in <prefix> instead of installing new
Environment variables:
CC path to the C compiler for bootstrapping
CXX path to the C++ compiler for bootstrapping
For example, to build Clang on a machine with multiple cores and
install it in `/opt/llvm`, you can use:
> ./install-clang -j 16 /opt/llvm
Once finished, just prefix your PATH with `<prefix>/bin` and you're
ready to use the new binaries:
> clang++ --std=c++11 --stdlib=libc++ test.cc -o a.out && ./a.out
Hello, Clang!
By default, install-clang currently installs the 6.0 release branches
of the relevant llvm.org projects. Adding `-m` on the command line
instructs the script to use the current git master versions instead.
The script downloads all the sources from the corresponding git
repositories and compiles the pieces as needed. Other OSs than macOS,
and Linux are not currently supported.
The script also has an update option `-u` that allows for catching up
with upstream repository changes without doing the complete
compile/install-from-scratch cycle again. Note, however, that unless
coupled with `-m`, this flag has no immediate effect since the git
versions to use are hardcoded to the Clang/LLVM release versions.
Doing a self-contained Clang installation is a bit more messy
than one would hope because the projects make assumptions about
specific system-wide installation paths to use. The install-clang
script captures some trial-and-error I (and others) went through to
get an independent setup working. It compiles Clang up to three
times, bootstrapping things with the system compiler as it goes. It
also patches some of the Clang/LLVM projects to incorporate the installation
prefix into configuration and search paths, and also fixes/tweaks a few
other things as well.
Docker
------
install-clang comes with a Dockerfile to build a Docker image, based
on Ubuntu, with Clang then in /opt/llvm:
# make docker-build && make docker-run
[... get a beer ...]
root@f39b941f177c:/# clang --version
clang version 6.0.1
Target: x86_64--linux-gnu
Thread model: posix
root@f39b941f177c:/# which clang
/opt/clang/bin/clang
A prebuilt image is available at https://hub.docker.com/r/rsmmr/clang/ .
News
----
### Version for Clang 6.0
The install-clang script for Clang 6.0 comes with these changes
compared to the 3.5 version:
* The default build type is now `Release`. It used to be
`RelWithDebInfo`.
* lldb and lld seem to built correctly on both Linux and Darwin now
and both are enabled by default.
* FreeBSD support is untested and hence disabled for now. Will be reactivated
once confirmed that it's working.
* On macOS, we no longer build for i386.
* The Docker image is now based on Ubuntu Xenial and puts everything
into `/opt/clang`.
### Version for Clang 3.5
The install-clang script for Clang 3.5 comes with a few changes
compared to earlier version:
* The script now supports FreeBSD as well. (Contributed by Matthias
Vallentin).
* The script now generally shared libraries for LLVM and clang, rather
than static ones.
* As libc++abi now works well on Linux as well, we use it generally
and no longer support libcxxrt.
* There are now command line options to select build mode and
assertions explicitly.
* There's no 3rd phase anymore building assertion-enabled LLVM
libraries, as changing compilation options isn't useful with shared
libraries.
* In return, there's a phase 0 now if the system compiler isn't a
clang; libc++abi needs clang that for its initial compilation
already.
* There's now a Dockerfile to build an image with Clang/LLVM in
/opt/llvm.
[1]: http://clang.llvm.org
[2]: http://www.llvm.org
[3]: http://libcxx.llvm.org
[4]: http://compiler-rt.llvm.org
[5]: http://libcxxabi.llvm.org
[6]: http://lldb.llvm.org
[7]: http://lld.llvm.org
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
install-clang6.zip (25个子文件)
install-clang
.dockerignore 19B
testit 320B
patches
tools--lldb--fix-pic.patch 1KB
projects--libcxx--install_name-macos.diff 3KB
tools--lldb--debugserver-fix.patch 4KB
tools--clang--linker-args.patch 2KB
projects--libcxxabi--install_name-macos.diff 1KB
tools--lldb--fix-linking.patch 1KB
Dockerfile 522B
test.cc 414B
README.md 5KB
Makefile 383B
.gitignore 20B
install-clang 13KB
patches.old
tools--clang--include-path.patch 994B
tools--extra--tidy-fix.patch 796B
tools--clang--freebsd-include.patch 1KB
projects--libcxxabi--unwind_h.patch 568B
stackmaps-for-elf.ec9de4677ac61.patch 2KB
projects--libcxx--libcxxabi-symbols.patch 1KB
projects--libcxx--prefix.diff 2KB
tools--clang--linker-args.patch 2KB
projects--compiler-rt--link-fix.patch 1KB
projects--libcxxabi--prefix.diff 1KB
fix-external-project-order.patch 821B
共 25 条
- 1
资源评论
- qq_391780382020-12-01下载了不能用
- langeldep2021-02-05没啥用, 看这里:https://blog.csdn.net/langeldep/article/details/113696764
無味雥嗔
- 粉丝: 6
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功