Skip to content

Commit 66de2f7

Browse files
Update README.md
1 parent da65771 commit 66de2f7

File tree

1 file changed

+29
-64
lines changed

1 file changed

+29
-64
lines changed

README.md

Lines changed: 29 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,36 @@
22

33
The Portable C++ Toolchain is a complete C/C++ toolchain based on LLVM.
44

5-
This toolchain has the following goals:
6-
* Create binaries compatible with a broad variety of Linux distributions
7-
* Support cross-compilation without necessitating specialty compilers
8-
* Provide a similar experience on Linux, macOS, and Windows
5+
With this toolchain you can:
6+
* Target a wide variety of operating systems with the same compiler
7+
* Create binaries compatible with nearly every Linux distribution
8+
* Cross-compile to Linux from any OS with no extra configuration
9+
* Use CMake or Bazel with minimal setup
10+
11+
## Supported targets
12+
* Linux
13+
* `x86_64-unknown-linux-gnu`
14+
* `x86_64-unknown-linux-musl`
15+
* `aarch64-unknown-linux-gnu`
16+
* `aarch64-unknown-linux-musl`
17+
* `armv7-unknown-linux-gnueabihf` (ARMv7-A with `vfpv3-d16` or later)
18+
* Apple (requires Xcode)
19+
* `x86_64-apple-macos`
20+
* `arm64-apple-macos`
21+
* and other targets supported by your Xcode version
22+
* Windows (requires Windows SDK)
23+
* `x86_64-pc-windows-msvc`
24+
* `aarch64-pc-windows-msvc`
25+
* Nvidia
26+
* `nvptx64-nvidia-cuda`
927

1028
## Build system integration
1129
### Bazel
1230

1331
This toolchain provides a Bazel rules integration.
1432
Consult the [release notes](https://github.com/CACI-International/cpp-toolchain/releases) for a quick start guide.
15-
For more information, see the [Bazel API documentation](bazel/docs).
33+
34+
For more complex usage, see the [Bazel API documentation](bazel/docs).
1635

1736
Note that the Bazel integration currently does not target Windows. Cross-compiling from Windows hosts to Linux targets is supported.
1837

@@ -21,76 +40,22 @@ Note that the Bazel integration currently does not target Windows. Cross-compili
2140
This toolchain provides a CMake integration.
2241
Consult the [release notes](https://github.com/CACI-International/cpp-toolchain/releases) for a quick start guide.
2342

24-
## Supported targets
43+
## Compatibility Notes
2544

2645
### Linux
2746

28-
The following targets are supported:
29-
* `aarch64-unknown-linux-gnu`
30-
* `x86_64-unknown-linux-gnu`
31-
* `armv7-unknown-linux-gnueabihf` (ARMv7-A with `vfpv3-d16` or later)
32-
33-
### macOS
34-
35-
To specify compatibility, compile with `-mmacosx-version-min=MAJOR.MINOR` or similar. Supported targets and versions depend on the installed Xcode version.
36-
37-
`arm64` and `x86_64` targets are supported. These include (but not limited to):
38-
* `arm64-apple-macos`
39-
* `x86_64-apple-macos`
40-
* `arm64-apple-ios`
47+
### GNU vs MUSL
48+
If you are compiling standalone executables, you can use the `musl` targets. This creates a fully static linked executable.
4149

42-
macOS hosts can also cross-compile to Linux targets.
50+
If you need to build dynamic libraries, or need to load system dynamic libraries, use the `gnu` targets. These create dynamically linked binaries that use an "old" glibc to maximize compatibility. The compiler runtime and libstdc++ are still linked statically.
4351

44-
### Windows
45-
46-
`arm64` and `x86_64` targets using the MSVC ABI are supported. These include (but not limited to):
47-
* `x86_64-pc-windows-msvc`
48-
* `aarch64-pc-windows-msvc`
49-
50-
### NVPTX
51-
52-
Clang is built with NVPTX support.
53-
54-
## Compatibility Notes
55-
56-
### Linux
57-
* glibc and libstdc++ are used rather than musl and libc++ to ensure compatibility when linking against system libraries on most distributions.
58-
* libstdc++ is statically linked into Linux binaries to maximize compatibility with older operating systems.
59-
* "Old" kernel headers are used to maximize compatibility with older operating systems.
52+
With either option, "old" kernel headers are used to maximize compatibility with older operating systems.
6053

6154
For exact versions, consult the release notes.
6255

6356
### macOS and Windows
6457
Apple and Microsoft provide their own SDKs that are not redistributed with this toolchain. You must install Xcode or the Windows SDK/Visual Studio to target those operating systems.
6558

66-
## Comparison to other toolchains and methods
67-
68-
Many other toolchains are available and have their own benefits and drawbacks. This section provides some information to help you decide which is best for you.
69-
70-
### Static linking musl libc
71-
72-
Many portable toolchains use static-linked [musl libc](https://musl.libc.org/), which produces an executable with _zero_ dynamic system dependencies!
73-
74-
This is likely your best choice if you are creating a single binary executable.
75-
76-
However, if you need to dynamic link or `dlopen` system dependencies, you can't mix musl and glibc. This toolchain might be a better choice for you.
77-
78-
### `zig cc` linking
79-
80-
The `zig cc` tool includes some [linker magic](https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html) to target specific glibc versions.
81-
82-
This might be a good choice for you, so you might try [`hermetic_cc_toolchain`](https://github.com/uber/hermetic_cc_toolchain).
83-
84-
If you want to link glibc the old-fashioned way, or are encountering bugs, you might prefer this toolchain.
85-
86-
### libc++ and LLVM runtime libraries
87-
88-
Many toolchains keep it simple by using LLVM's libc++ and compiler runtime.
89-
90-
For a self-contained executable, this might be a good option for you.
91-
92-
If you are producing binaries that will interact with system libraries or toolchains, the LLVM runtime might produce ABI mismatches with the GNU runtime. In that situation, this toolchain may be a better choice.
93-
9459
## License
9560

9661
The toolchains are released under their respective licenses. The code in this repository is licensed under the Apache License, Version 2.0.

0 commit comments

Comments
 (0)