You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am under amd64 and I want to cross compile a dynamic library for arm. My document structure is as follows:
in GOPATH/src :
/demo
|----demo.go
/main
|----main.go
$ cat main.go
package main
import demo
func main(){
demo.Demo()
}
I have execute the command as follows:
$ export GOARCH="arm"
$ export CGO_ENABLED="0"
$ go install -buildmode=shared -linkshared std
$ go install -buildmode=shared -linkshared demo
$ go build -linkshared main.go
These produce libstd.so in $GOROOT/pkg/linux_amd64_dynlink, libdemo.so in $GOPATH/pkg and a binary file called main in $GOPATH/src.
However, when I put these 3 files on arm, the binary file called main can not be run because of file format error.
How can I cross compile the dynamic library for arm on my linux/amd64 computer???
The text was updated successfully, but these errors were encountered:
You need to have a cross-compiler from linux/amd64 to ARM.
In general we do not use the issue tracker for questions. You will get better and faster answers in a forum. See https://golang.org/wiki/Questions. Thanks.
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputI am under amd64 and I want to cross compile a dynamic library for arm. My document structure is as follows:
in GOPATH/src :
/demo
|----demo.go
/main
|----main.go
$ cat main.go
package main
import demo
func main(){
demo.Demo()
}
I have execute the command as follows:
$ export GOARCH="arm"
$ export CGO_ENABLED="0"
$ go install -buildmode=shared -linkshared std
$ go install -buildmode=shared -linkshared demo
$ go build -linkshared main.go
These produce libstd.so in $GOROOT/pkg/linux_amd64_dynlink, libdemo.so in $GOPATH/pkg and a binary file called main in $GOPATH/src.
However, when I put these 3 files on arm, the binary file called main can not be run because of file format error.
How can I cross compile the dynamic library for arm on my linux/amd64 computer???
The text was updated successfully, but these errors were encountered: