You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-64Lines changed: 29 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,36 @@
2
2
3
3
The Portable C++ Toolchain is a complete C/C++ toolchain based on LLVM.
4
4
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`
9
27
10
28
## Build system integration
11
29
### Bazel
12
30
13
31
This toolchain provides a Bazel rules integration.
14
32
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).
16
35
17
36
Note that the Bazel integration currently does not target Windows. Cross-compiling from Windows hosts to Linux targets is supported.
18
37
@@ -21,76 +40,22 @@ Note that the Bazel integration currently does not target Windows. Cross-compili
21
40
This toolchain provides a CMake integration.
22
41
Consult the [release notes](https://github.com/CACI-International/cpp-toolchain/releases) for a quick start guide.
23
42
24
-
## Supported targets
43
+
## Compatibility Notes
25
44
26
45
### Linux
27
46
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.
41
49
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.
43
51
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.
60
53
61
54
For exact versions, consult the release notes.
62
55
63
56
### macOS and Windows
64
57
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.
65
58
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
-
94
59
## License
95
60
96
61
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