Go – 使用xgo库与CGO交叉编译

我试图编译一个GO应用程序,它使用gokiri库。 我安装了docker并在本地编译了xgo交叉编译器。 当试图执行以下命令时:

./xgo mydomain.com/test/test-app 

我得到以下错误:

 In file included from /usr/include/libxml2/libxml/parser.h:810:0, from /usr/include/libxml2/libxml/globals.h:18, from /usr/include/libxml2/libxml/threads.h:35, from /usr/include/libxml2/libxml/xmlmemory.h:218, from /usr/include/libxml2/libxml/tree.h:1307, from ../../github.com/moovweb/gokogiri/help/help.go:6: /usr/include/libxml2/libxml/encoding.h:28:19: fatal error: iconv.h: No such file or directory 

我已经安装了xcode-tools帮助我编译我的机器(mac ox El Capitan)。 但是,我不能把它编译到其他环境。

任何帮助将不胜感激。 谢谢。

更新1:

我试图添加依赖关系,但得到了相同的结果:

 ./xgo --deps /usr/local/Cellar/libiconv/1.14/ mydomain.com/test/test-app 

甚至在xgo的日志中提到这个库已经被caching了:

 Dependency already cached: /Users/macuser/.xgo-cache/1.14.