diff options
| author | Elias Naur <elias.naur@gmail.com> | 2014-05-20 01:32:31 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-05-20 01:32:31 -0400 |
| commit | 88d07b2cbcf0ad5e2e9936bcaec4fd25e38bec10 (patch) | |
| tree | 4276fc1f0e77e19bb6b8cd39ecaeed313b642bf5 | |
| parent | d9c9665f1dcd09b0e315c9437d192fed795587a5 (diff) | |
| download | go-88d07b2cbcf0ad5e2e9936bcaec4fd25e38bec10.tar.xz | |
cmd/cgo: document CC_FOR_TARGET and CXX_FOR_TARGET
Update #4714
LGTM=iant, minux.ma, rsc
R=rsc, iant, r, minux.ma
CC=golang-codereviews
https://golang.org/cl/100390043
| -rw-r--r-- | doc/go1.3.html | 7 | ||||
| -rw-r--r-- | src/cmd/cgo/doc.go | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/doc/go1.3.html b/doc/go1.3.html index 5404f4ec66..900f6c77fc 100644 --- a/doc/go1.3.html +++ b/doc/go1.3.html @@ -227,6 +227,13 @@ of the specified target, but not the target itself. </p> <p> +Cross compiling with <a href="/cmd/cgo/"><code>cgo</code></a> enabled +is now supported. The CC_FOR_TARGET and CXX_FOR_TARGET environment +variables are used when running all.bash to specify the cross compilers +for C and C++ code, respectively. +</p> + +<p> Finally, the go command now supports packages that import Objective-C files (suffixed <code>.m</code>) through cgo. </p> diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index 057d25f5b4..e95915e55e 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -63,6 +63,18 @@ 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. + Go references to C Within the Go file, C's struct field names that are keywords in Go |
