Can Windows cross-compile Linux executables?
sujunbo opened this issue · comments
zeus commented
D:\WinfoGo\src\MSA_GD\example\pub>SET GOOS=linux
D:\WinfoGo\src\MSA_GD\example\pub>go build -o zmqPubServer pub.go
github.com/pebbe/zmq4
D:\WinfoGo\pkg\mod\github.com\pebbe\zmq4@v1.0.0\reactor.go:10:4: undefined: State
D:\WinfoGo\pkg\mod\github.com\pebbe\zmq4@v1.0.0\reactor.go:11:9: undefined: State
Justin Zandbergen commented
I'm having the same error when i try to statically link the library using:
GOOS=linux CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' ./cmd/myproject
Tom Depew commented
I believe this is due to dependency on the C libzmq
library. You could try rebuilding with CGO_ENABLED=1