英文:
Problem in Installing Golang ZMQ for windows - fatal error: czmq.h: No such file or directory
问题
我尝试在Golang中使用ZMQ
库,并使用以下页面的指南:https://zeromq.org/languages/go/。根据文档,libsodium
、libzmq
和czmq
是依赖项。
从https://jmeubank.github.io/tdm-gcc/download/下载GCC,并将其安装在C:\gcc
目录中。
然后,为了安装vcpkg
(用于安装其他软件包),下载并提取https://github.com/Microsoft/vcpkg存储库到C:\dev
目录。使用以下命令进行安装:
C:\dev>bootstrap-vcpkg.bat
根据https://libsodium.gitbook.io/doc/installation安装libsodium
,执行以下命令:
cd C:\dev
vcpkg integrate install
vcpkg install libsodium
使用以下命令安装libzmq
和czmq
:
vcpkg install zeromq:x64-windows-static
vcpkg install czmq:x64-windows-static
安装完依赖项后,我尝试安装Golang的zeromq
。但运行以下命令时:
go get gopkg.in/zeromq/goczmq.v4
出现了以下错误:
go get gopkg.in/zeromq/goczmq.v4
# gopkg.in/zeromq/goczmq.v4
C:\Users\Noori\go\pkg\mod\gopkg.in\zeromq\goczmq.v4@v4.1.0\auth.go:4:10: fatal error: czmq.h: No such file or directory
4 | #include "czmq.h"
| ^~~~~~~~
compilation terminated.
Windows和Golang版本:Windows 10-x64和Go 1.17.3
go version
go version go1.17.3 windows/amd64
我是一个Golang的初学者,请在这个领域帮助我。
英文:
I tried to use ZMQ
library in Golang and use instructions from the following page: https://zeromq.org/languages/go/. Based on the document, libsodium
, libzmq
and czmq
are dependencies.
GCC downloaded from https://jmeubank.github.io/tdm-gcc/download/ and installed in C:\gcc
.
Then for installing vcpkg
(used for installing other packages) the https://github.com/Microsoft/vcpkg repository is downloaded and extracted at C:\dev
directory. The following command is used for installation:
C:\dev>bootstrap-vcpkg.bat
To install libsodium
based on https://libsodium.gitbook.io/doc/installation, the following commands executed:
cd C:\dev
vcpkg integrate install
vcpkg install libsodium
To install libzmq
and czmq
following commands are used:
vcpkg install zeromq:x64-windows-static
vcpkg install czmq:x64-windows-static
After installing dependencies I tried to install zeromq
for Golang. But running the following command:
go get gopkg.in/zeromq/goczmq.v4
Caused this error:
go get gopkg.in/zeromq/goczmq.v4
# gopkg.in/zeromq/goczmq.v4
C:\Users\Noori\go\pkg\mod\gopkg.in\zeromq\goczmq.v4@v4.1.0\auth.go:4:10: fatal error: czmq.h: No such file or directory
4 | #include "czmq.h"
| ^~~~~~~~
compilation terminated.
Windows and Golang version: Windows 10-x64 and Go 1.17.3
go version
go version go1.17.3 windows/amd64
I'm a beginner in golang, please help me in this field.
答案1
得分: 1
经过多次尝试,我发现了如何在Go中安装zmq
。
首先,我尝试了另一个GCC
软件。从https://www.msys2.org/下载软件并安装在C:\msys64
上。
然后将C:\msys64\mingw64\bin
添加到Windows的PATH
环境变量中。
然后逐个运行以下命令(在执行命令之前,请查看解决方案底部的2022年11月5日更新)。
pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
pacman -S base-devel gcc vim cmake
pacman -S mingw-w64-x86_64-libsodium
pacman -S mingw-w64-x86_64-zeromq
最后,运行Go
安装命令:
go get github.com/pebbe/zmq4
完成。
现在看起来很简单
英文:
After many tries, I discovered how to install zmq
for Go
.
First of all, I tried another GCC
software. Software downloaded from https://www.msys2.org/ and installed on C:\msys64
.
Then add C:\msys64\mingw64\bin
to the PATH
environment variable of the windows.
Then run the following commands one by one (before executing the commands please see the update 5 Nov 2022 at the bottom of this solution).
pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
pacman -S base-devel gcc vim cmake
pacman -S mingw-w64-x86_64-libsodium
pacman -S mingw-w64-x86_64-zeromq
Finally, run the Go
install command:
go get github.com/pebbe/zmq4
Finished.
Now it seems easy
Update 5 Nov 2022
By updating MSYS some errors were raised in this solution:
> David Macek <david.macek.0@gmail.com> is unknown trust
Based on this page, before running the pacman command, its configurations should edit.
To work correctly, edit the C:\msys64\etc\pacman.conf
file and edit the line SigLevel
to SigLevel = Never
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论