将Go编译为Raspberry Pi的共享对象。

huangapple 未分类评论59阅读模式
英文:

Compile Go into Shared Object for Raspberry Pi

问题

我想编译我的Go库,以便我可以通过JNI从Java中调用它在树莓派上。

我知道我需要将Go库构建为.so(共享对象),以便JNI可以引用它。我尝试过.a(存档),但Java报告无效格式。

我一直在尝试运行以下命令,但出现了下面显示的错误:

go install -buildmode=c-shared -linkshared SimpleLib

错误信息:

-linkshared仅支持linux/amd64

我目前是在Mac OSX上构建,但这个错误是否意味着我只能在Linux机器上构建,比如Ubuntu?还是错误与所需的输出有关。

另外,我应该研究一下gccgo吗?

谢谢。

英文:

I would like to compile my Go library so that I can call it from Java via JNI on Raspberry Pi.

I am aware that I need to build the Go library into a .so (Shared Object) so that JNI can reference it. I have tried .a (Archive) but Java complains about invalid format.

I have been trying to run the following command but get the error shown below:

go install -buildmode=c-shared -linkshared SimpleLib

Error

-linkshared is only supported on linux/amd64

I am currently building via Mac OSX but does the error mean that I can only build from a Linux machine i.e. Ubuntu? Or is the error related to the required output.

Also, should I be looking into gccgo

Thanks

huangapple
  • 本文由 发表于 2016年3月31日 16:03:22
  • 转载请务必保留本文链接:https://java.coder-hub.com/36327518.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定