]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: document how CGO_ENABLED works today
authorIan Lance Taylor <iant@golang.org>
Fri, 24 Jul 2015 00:14:48 +0000 (17:14 -0700)
committerIan Lance Taylor <iant@golang.org>
Sun, 26 Jul 2015 21:04:47 +0000 (21:04 +0000)
Fixes #9530.

Change-Id: Iadfc027c7164e3ba35adb5c67deb42b51d3498ca
Reviewed-on: https://go-review.googlesource.com/12603
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
src/cmd/cgo/doc.go

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