编译进入Raspberry Pi的共享对象

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