pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.18k stars 164 forks source link

Can Windows cross-compile Linux executables? #156

Open sujunbo opened 5 years ago

sujunbo commented 5 years ago

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

jzandbergen commented 4 years ago

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
tdpu commented 3 years ago

I believe this is due to dependency on the C libzmq library. You could try rebuilding with CGO_ENABLED=1