douou9094747 2016-07-05 16:22
浏览 895

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

I'm trying to compile a GO application, which uses the gokiri library. I installed docker and compiled locally the xgo cross compiler for go. When trying to execute the following command:

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

I get the following error:

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

I've installed xcode-tools which helped me compile it for my machine (mac ox El Capitan). BUT, I cannot get it compiled to other environment.

Any help will be appreciated. Thanks.

Update 1:

I've tried to add the dependency, but got the same result:

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

It was even mentioned in the logs of the xgo that this library was already cached:

Dependency already cached: /Users/macuser/.xgo-cache/1.14.
  • 写回答

1条回答 默认 最新

  • duancao2082 2018-04-06 13:18
    关注

    from the documentation:

    It is assumed that the dependent C/C++ library is configure/make based, was properly prepared for cross compilation and is available as a tarball download (.tar, .tar.gz or .tar.bz2). Further plans include extending this to cmake based projects, if need arises (please open an issue if it's important to you).

    Such dependencies can be added via the --deps argument. They will be retrieved prior to starting the cross compilation and the packages cached to save bandwidth on subsequent calls.

    So in this example, it would be:

    ./xgo --deps https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz mydomain.com/test/test-app

    评论

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?