英文:
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
专注分享java语言的经验与见解,让所有开发者获益!
评论