douzhunlan5930
2015-02-19 18:16
浏览 272
已采纳

使用Golang进行Mac交叉编译(或替代)

Ok so I'm trying to compile my Awesomium go wrapper on my mac (everything works fine on linux). My problem is, when I try to compile I get

ld: warning: ignoring file /Library/Frameworks//Awesomium.framework/Awesomium, file was built for i386 which is not the architecture being linked (x86_64): /Library/Frameworks//Awesomium.framework/Awesomium Undefined symbols for architecture x86_64:

Fine. But that raises a few questions. First, I didn't have the option to download a x86_64 version for Mac, it was "the mac version" no architecture. Second, I checked a few other libraries and it seems like nothing is built x86_64.
Now I thought maybe I could make a i386 version just for osx but it seems it's extremely difficult, some say impossible, to cross compile cgo.

What are my options?

图片转代码服务由CSDN问答提供 功能建议

好,所以我尝试编译 Awesomium 在我的Mac上运行 wrapper (在Linux上一切正常 )。 我的问题是,当我尝试编译时,我得到

ld:警告:忽略文件/Library/Frameworks//Awesomium.framework/Awesomium,该文件是为i386构建的 不是链接的架构(x86_64):/Library/Frameworks//Awesomium.framework/Awesomium 架构x86_64的未定义符号:

Fine。 但这引发了一些问题。 首先,我没有选择下载Mac的x86_64版本,它是“ mac版本”无体系结构。 其次,我检查了其他一些库,似乎没有构建x86_64。
现在我想也许我可以为osx制作i386版本,但是交叉编译cgo似乎非常困难,有人说不可能。

我有什么选择?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duansao20000508 2015-02-19 21:08
    已采纳

    I'm not sure if you're going to run into any other problems with the universal binary, but building an i386 go toolchain is fairly easy.

    http://golang.org/doc/install/source

    You can then set the GOHOSTARCH and GOARCH environment variables, e.g.

    GOHOSTARCH=386 GOARCH=386 ./all.bash
    
    点赞 评论

相关推荐 更多相似问题