@@ -90,17 +90,19 @@ compilers may be changed by the CC and CXX environment variables,
90
90
respectively; those environment variables may include command line
91
91
options.
92
92
93
- To enable cgo during cross compiling builds, set the CGO_ENABLED
94
- environment variable to 1 when building the Go tools with make.bash.
95
- Also, set CC_FOR_TARGET to the C cross compiler for the target. CC will
96
- be used for compiling for the host.
97
-
98
- After the Go tools are built, when running the go command, CC_FOR_TARGET is
99
- ignored. The value of CC_FOR_TARGET when running make.bash is the default
100
- compiler. However, you can set the environment variable CC, not CC_FOR_TARGET,
101
- to control the compiler when running the go tool.
102
-
103
- CXX_FOR_TARGET works in a similar way for C++ code.
93
+ The cgo tool is enabled by default for native builds on systems where
94
+ it is expected to work. It is disabled by default when
95
+ cross-compiling. You can control this by setting the CGO_ENABLED
96
+ environment variable when running the go tool: set it to 1 to enable
97
+ the use of cgo, and to 0 to disable it. The go tool will set the
98
+ build constraint "cgo" if cgo is enabled.
99
+
100
+ When cross-compiling, you must specify a C cross-compiler for cgo to
101
+ use. You can do this by setting the CC_FOR_TARGET environment
102
+ variable when building the toolchain using make.bash, or by setting
103
+ the CC environment variable any time you run the go tool. The
104
+ CXX_FOR_TARGET and CXX environment variables work in a similar way for
105
+ C++ code.
104
106
105
107
Go references to C
106
108
0 commit comments