go项目开发时,报cc1.exe: sorry, unimplemented: 64-bit mode not compiled in解决办法
go项目开发时,报cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
错误
# git clone https://github.com/Calcium-Ion/new-api.git
# cd new-api
# go version
go version go1.20.12 windows/amd64
# set GOPROXY=https://goproxy.cn
# go install
...
go: downloading golang.org/x/sync v0.1.0
# github.com/jackc/puddle/v2
C:\Users\yezhou\go\pkg\mod\github.com\jackc\puddle\v2@v2.2.1\pool.go:142:30: undefined: atomic.Int64
note: module requires Go 1.19
# github.com/chai2010/webp
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
# github.com/mattn/go-sqlite3
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
原因分析:通过提示可知;cc1.exe版本不是64位的,在64位环境下无法编译
解决办法:需要将mingw32换成mingw64.
下载地址:https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
MinGW-W64 Online Installer:https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe
- 安装:选择64位版本x86_64架构安装
- 默认安装在:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
- 安装完成后添加环境变量:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
若MinGW-w64下载文件失败报:Tthe file has been downloaded incorrectly
因为文件资源是托管在sourceforge上面的,因此在线安装器需要从该网站上下载文件。99%都是网络不好导致下载失败,有能力者可以科学上网解决。没办法科学上网的同学可以直接下载离线安装包。
前往MinGW-w64的sourceforge页面,直接下载完整的包即可,如下图所示:
版本这里根据各自的电脑选择,我的电脑是64位,所以选择x86_64;电脑是windows系统,所以选择 win32;seh是先进的异常处理模式技术,支持64位操作系统。其他硬件情况可以参考MinGW-w64安装教程——著名C/C++编译器GCC的Windows版本。
配置环境变量:E:\Program Files\mingw64\bin
使用命令行输入gcc -v
验证安装并且配置环境变量是否成功:
> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=E:/Program\ Files/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-win32-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: win32
gcc version 8.1.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project)
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2024/01/13/go-cc1-exe-unimplemented-64-bit-mode-not-compiled-in/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论