Install zmq4 Go Windows
const97 opened this issue · comments
I would like to use zmq4 (https://github.com/pebbe/zmq4) in Go Programming Language on a Windows system. This need to have ZeroMQ (libzmq) installed (https://zeromq.org/download/ or https://github.com/zeromq/libzmq). Unfortunately, I can not find a way to install libzmq on Windows. Can anyone help me?
Hi Const, I do also try to build for windows too. Did you have any progress about that? @const97
@berkantay it's not working!! Your problem is solved or not?
@ThakkarChandresh It has been a year since I solved the issue. Therefore solution from a year ago MAY NOT be working today. Could you give more details about your issue so that maybe I can help?
@berkantay Thanks for replying
First, when I imported the "github.com/pebbe/zmq4" library i was facing the issue
# github.com/pebbe/zmq4
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:10:4: undefined: State
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:11:9: undefined: State
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:21:16: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:23:12: undefined: Poller
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:61:34: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:61:49: undefined: State
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:68:37: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\ctxoptions_windows.go:21:12: undefined: Context
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\ctxoptions_windows.go:42:12: undefined: Context
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\utils.go:17:12: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\utils.go:17:12: too many errors
Then I've changed the CGO_ENABLED env to 1
go env -w CGO_ENABLED=1
Then I'm facing the issue
# runtime/cgo
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%
As it says there is no gcc, so I've installed the Mingw64 bit gcc compiler, then it gave the error
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
Then i tried your way,
Install vcpkg vcpkg
Then run vcpkg.exe install zeromq
(Note: I've uninstalled mingw64 bit gcc as it's not working)
Then set the env variables according to the readme file, again it was giving the same error
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%
So I've reset the CGO_ENABLED env to 0
go env -w CGO_ENABLED=0
And now again I'm getting the error
# github.com/pebbe/zmq4
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:10:4: undefined: State
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:11:9: undefined: State
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:21:16: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:23:12: undefined: Poller
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:61:34: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:61:49: undefined: State
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\reactor.go:68:37: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\ctxoptions_windows.go:21:12: undefined: Context
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\ctxoptions_windows.go:42:12: undefined: Context
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\utils.go:17:12: undefined: Socket
..\..\go\pkg\mod\github.com\pebbe\zmq4@v1.2.10\utils.go:17:12: too many errors
Can you please help me i need it anyhow!!
@ThakkarChandresh Could you send the environment variables you set?
@berkantay My Current environment variables
And also set the PATH in System Variables to point the libzmq-mt-4_3_5.dll
file
C:\dev\vcpkg\packages\zeromq_x64-windows\bin
@ThakkarChandresh There are several issues here;
- You do not have to point .dll file to the path. .dll is needed at the same point with your executable.
CGO_CFLAGS='-ID:/dev/vcpkg/installed/x64-windows/include'
andCGO_LDFLAGS='-LD:/dev/vcpkg/installed/x64-windows/lib -l:libzmq-mt-4_3_4.lib'
must also be in the PATH.- I couldn't see mingw64-gcc on path.
- You do not have to add libzmq to the path.
-
You do not have to point .dll file to the path. .dll is needed at the same point with your executable.
-> removed And added with the executable.
-
CGO_CFLAGS='-ID:/dev/vcpkg/installed/x64-windows/include'and CGO_LDFLAGS='-LD:/dev/vcpkg/installed/x64-windows/lib -l:libzmq-mt-4_3_4.lib' (must also be in the PATH. can you please explain? under system variables ? and how?)
-
I couldn't see mingw64-gcc on path.
->Downloaded from this link
now with CGO_ENABLED=1
facing the same error
# runtime/cgo
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
- First step is OK.
- Second step is half correct. Please pass the correct path to
CGO_FLAGS
andCGO_LDFLAGS
. These are required for CGO to link libraries./dev/vcpkg
is not valid for Windows. - You have to set the binary path of install mingw-gcc to PATH manually.
CGO_CFLAGS
and CGO_LDFLAGS
should be in environment variable PATH as the same place with mingw/bin.
If those are the correct paths as it mentioned above then yes.
How is the result?
# runtime/cgo
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
I've two questions
- why this is saying 64-bit mode
- What does this -ID: and -LD: means
Your gcc version may be 32 bit
ID and LD is related with linking libzmq to zmq4. https://stackoverflow.com/a/39867163/13524252
How to check that gcc is 32 bit or 64 bit, and if it's the case then any reference or guide to install 64 bit gcc?
@berkantay Do you have a solution for this error? I installed Visual Studio Community edition, rebooted it, then ran the install command again for zeromq and this is what I received: