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 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据