go系列&运维系列&Windows系列:cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
前言
在Windows环境下使用Go处理Ethereum项目时遇到64位模式不支持的错误,原因是安装的MinGW是32位版本。解决方案是下载并安装64位的MinGW-W64,更新系统环境变量,确保GCC编译器在PATH路径中。完成这些步骤后,重新执行Go编译和测试,问题应当得到解决。
问题
使用go语言处理ethereum项目,在windows环境下执行测试程序时,报错
# runtime/cgo
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
FAIL command-line-arguments [build failed]
FAIL
解决办法
分析错误日志,显示64位模式不支持。那么在windows上安装的是mingw编译器,查看mingw发现确实是32位的。

所以需要从MinGW官网上下载安装64位版本,进入其官网下载页https://www.mingw-w64.org/downloads/,发现有很多不同的版本。

选择MingW-W64-builds版本,下载后进入安装流程,选择x86_64后,下一步继续安装
配置windows环境变量,将安装MinGW的bin目录添加到系统环境变量PATH中。
如未安装,可能会报错,如下为一个例子
# runtime/cgo
cgo: C compiler “gcc” not found: exec: “gcc”: executable file not found in %PATH%
FAIL command-line-arguments [build failed]
FAIL
完成安装以及环境变量配置后,执行go编译运行应该就没有问题了。
浙公网安备 33010602011771号