<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>《Golang跨平台交叉编译》的评论</title>
	<atom:link href="http://tonybai.com/2014/10/20/cross-compilation-with-golang/feed/" rel="self" type="application/rss+xml" />
	<link>https://tonybai.com/2014/10/20/cross-compilation-with-golang/</link>
	<description>一个程序员的心路历程</description>
	<lastBuildDate>Wed, 25 Mar 2026 09:21:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>作者：bigwhite</title>
		<link>https://tonybai.com/2014/10/20/cross-compilation-with-golang/#comment-7311</link>
		<dc:creator>bigwhite</dc:creator>
		<pubDate>Mon, 24 Dec 2018 22:32:34 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1571#comment-7311</guid>
		<description>从go程序编译的原理上讲，目前如果代码这种使用了cgo，依然无法时间交叉编译。因为你在macos上或linux上编译目标平台是arm的android版本的go程序，cgo_enabled=0 时，编译器要resolve你代码中的c代码的的各种符号以及相关syscall。但是在macos或linux根本没有对应的.a或.so文件。cgo_enabled=1的情况下，go compiler会自动选择external linking的机制，即会调用系统默认的c compiler去编译那部分c代码。你的第二种情况的错误输出就是这个情况：go compiler调用了clang去编译c代码时报错了。建议你在看看我的这篇文章：http://tonybai.com/2017/06/27/an-intro-about-go-portability</description>
		<content:encoded><![CDATA[<p>从go程序编译的原理上讲，目前如果代码这种使用了cgo，依然无法时间交叉编译。因为你在macos上或linux上编译目标平台是arm的android版本的go程序，cgo_enabled=0 时，编译器要resolve你代码中的c代码的的各种符号以及相关syscall。但是在macos或linux根本没有对应的.a或.so文件。cgo_enabled=1的情况下，go compiler会自动选择external linking的机制，即会调用系统默认的c compiler去编译那部分c代码。你的第二种情况的错误输出就是这个情况：go compiler调用了clang去编译c代码时报错了。建议你在看看我的这篇文章：http://tonybai.com/2017/06/27/an-intro-about-go-portability</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：钟镇威</title>
		<link>https://tonybai.com/2014/10/20/cross-compilation-with-golang/#comment-7310</link>
		<dc:creator>钟镇威</dc:creator>
		<pubDate>Mon, 24 Dec 2018 16:20:32 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1571#comment-7310</guid>
		<description>您好，您这边文章中提到“如果Go源码中包含C互操作代码，那么 目前依旧无法实现交叉编译”， 目前现在依然如此吗，我现在在尝试编译android平台能用的so库，我的命令也是跟您差不多：GOOS=android GOARCH=arm go build -buildmode=c-shared -o=libgojni.so，提示can&#039;t load package，我的go代码中也是import了C库，应该就是这个import导致的问题，我接着又尝试了“CGO_ENABLED=1 GOOS=android GOARCH=arm go build -buildmode=c-shared -o=libgojni.so”，错误成了“clang: error: argument unused during compilation: &#039;-mno-thumb&#039; [-Werror,-Wunused-command-line-argument]”，我是现在才接触的go，我下载的时候go已经是1.9几的版本了，现在依然没有办法解决这个问题吗？虚心求教，这个问题困扰我两三天了，求解</description>
		<content:encoded><![CDATA[<p>您好，您这边文章中提到“如果Go源码中包含C互操作代码，那么 目前依旧无法实现交叉编译”， 目前现在依然如此吗，我现在在尝试编译android平台能用的so库，我的命令也是跟您差不多：GOOS=android GOARCH=arm go build -buildmode=c-shared -o=libgojni.so，提示can&#8217;t load package，我的go代码中也是import了C库，应该就是这个import导致的问题，我接着又尝试了“CGO_ENABLED=1 GOOS=android GOARCH=arm go build -buildmode=c-shared -o=libgojni.so”，错误成了“clang: error: argument unused during compilation: &#8216;-mno-thumb&#8217; [-Werror,-Wunused-command-line-argument]”，我是现在才接触的go，我下载的时候go已经是1.9几的版本了，现在依然没有办法解决这个问题吗？虚心求教，这个问题困扰我两三天了，求解</p>
]]></content:encoded>
	</item>
</channel>
</rss>
