<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cross-Compilation on tenfy's blog</title><link>https://tenfy.cn/tags/cross-compilation/</link><description>Recent content in Cross-Compilation on tenfy's blog</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Tue, 17 Oct 2017 09:00:35 +0000</lastBuildDate><atom:link href="https://tenfy.cn/tags/cross-compilation/index.xml" rel="self" type="application/rss+xml"/><item><title>golang交叉编译</title><link>https://tenfy.cn/posts/golang-cross-compile/</link><pubDate>Tue, 17 Oct 2017 09:00:35 +0000</pubDate><guid>https://tenfy.cn/posts/golang-cross-compile/</guid><description>&lt;p>golang的交叉编译。&lt;/p>
&lt;p>golang的交叉编译非常简单，只要配好对应的环境变量后再&lt;code>go build&lt;/code>就可以了。
需要配置以下的环境变量。&lt;/p>
&lt;h1 id="cgo_enabled">&lt;code>CGO_ENABLED&lt;/code>&lt;/h1>
&lt;p>默认情况下这个变量为1。
交叉编译不支持cgo，所以需要关闭cgo。
linux/unix下为&lt;code>CGO_ENABLED=0&lt;/code>。
windows下为&lt;code>set CGO_ENABLED=0&lt;/code>。&lt;/p></description></item></channel></rss>