jas*_*nth 48 windows build go cgo hyperledger-fabric
我正在使用Windows 10.当我尝试构建Chaincode时,它报告了此错误
# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
exec: "gcc": executable file not found in %PATH%
Run Code Online (Sandbox Code Playgroud)
我的链码导入:
import (
"fmt"
"strconv"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
Run Code Online (Sandbox Code Playgroud)
它在Docker中运行良好.
pet*_*rSO 46
gcc(GNU编译器集合)提供了一个C编译器.在Windows上,安装TDM-GCC.该github.com/miekg/pkcs11软件包使用cgo.Cgo支持创建调用C代码的Go包.
Yag*_*nci 15
如果您在 Dockerfile 中使用基于 alpine 的映像
安装build-base它将满足您的要求。
apk add build-base
Run Code Online (Sandbox Code Playgroud)
mah*_*ima 12
apt-get install build-essential
Run Code Online (Sandbox Code Playgroud)
这样就解决了问题。它会安装gcc / g ++编译器和库。
$ go env
Run Code Online (Sandbox Code Playgroud)
检查CGO_ENABLED是否为1将其更改为0
$export CGO_ENABLED=0
Run Code Online (Sandbox Code Playgroud)
1) Install .exe from > https://sourceforge.net/projects/mingw-w64/
1.2) ! use x86_64 architecture
2) Add C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin to PATH in User Variables and in System Variables. For me it works.
!要编辑Path变量,请Windows按键,键入“ path”,选择“ Edit the system environment variables”,单击“ Environment Variables”,Path在System variables和中找到变量,User variables然后进行编辑。
对于我的情况:操作系统:windows 10
命令:
choco install mingw
如果未安装,请安装 choco:链接: https: //www.liquidweb.com/kb/how-to-install-chocolatey-on-windows/
为我工作。
| 归档时间: |
|
| 查看次数: |
46761 次 |
| 最近记录: |