php小编西瓜今天为大家带来一个关于Go语言的问题:Qtdeploy在使用过程中会出现间歇性失败的情况。Qtdeploy是一个用于将Go语言程序打包成可执行文件的工具,但有些用户在使用时遇到了间歇性失败的问题。我们将在本文中探讨这个问题的可能原因,并提供解决方案,帮助大家顺利使用Qtdeploy。
我运行的是 Windows 10 x64,当我尝试使用以下命令构建应用程序时遇到问题: qtdeploy测试桌面 或者 qtdeploy构建桌面
我间歇性地收到下面列出的错误。如果我多尝试几次,通常就能编译,但有时根本不会编译。顺便说一句,我正在使用 VScode 作为我的 IDE。我的项目也位于 DropBox 目录中。同步打开或关闭似乎并不重要。任何人可以提供的任何帮助或线索将不胜感激!
错误最值得注意的部分:
wm/sbs/launch/cancellations/ui wm/sbs/launch/cancellations # wm/sbs/launch/cancellations C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running g++ failed: exit status 1 C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lzstd: No such file or directory collect2.exe: error: ld returned 1 exit status
我的 Go 环境:
set GO111MODULE=on set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\aellis4\AppData\Local\go-build set GOENV=C:\Users\aellis4\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\aellis4\go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\Users\aellis4\go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLCHAIN=auto set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.21.3 set GCCGO=gccgo set GOAMD64=v1 set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=C:\Users\aellis4\Dropbox\WM Projects\Cancellations\Source\Cancellation Process 2.0 - TEST6\go.mod set GOWORK= set CGO_CFLAGS=-O2 -g set CGO_CPPFLAGS= set CGO_CXXFLAGS=-O2 -g set CGO_FFLAGS=-O2 -g set CGO_LDFLAGS=-O2 -g set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\aellis4\AppData\Local\Temp\go-build1414384863=/tmp/go-build -gno-record-gcc-switches
QtSetup 检查:
time="2023-10-20T14:57:44-04:00" level=info msg="running: 'qtsetup check windows' [docker=false] [vagrant=false]" time="2023-10-20T14:57:44-04:00" level=info msg="GOOS: 'windows'" time="2023-10-20T14:57:44-04:00" level=info msg="GOARCH: 'amd64'" time="2023-10-20T14:57:44-04:00" level=info msg="GOVERSION: 'go1.21.3'" time="2023-10-20T14:57:44-04:00" level=info msg="GOROOT: * 'C:\\Program Files\\Go'" time="2023-10-20T14:57:44-04:00" level=info msg="GOPATH: * 'C:\\Users\\aellis4\\go'" time="2023-10-20T14:57:44-04:00" level=info msg="GOBIN: 'C:\\Users\\aellis4\\go\\bin'" time="2023-10-20T14:57:44-04:00" level=info msg="GOMOD: 'C:\\Users\\aellis4\\Dropbox\\WM Projects\\Cancellations\\Source\\Cancellation Process 2.0 - TEST6\\go.mod'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_HASH: 'v0.0.0-20200817163748-494d2f8c1ebe'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_API: ''" time="2023-10-20T14:57:44-04:00" level=info msg="QT_VERSION: * '5.13.0'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_DIR: 'C:\\Qt'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_STUB: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_DEBUG: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_QMAKE_DIR: ''" time="2023-10-20T14:57:44-04:00" level=info msg="QT_WEBKIT: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_STATIC: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_GEN_GO: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_GEN_OPENGL: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_GEN_QUICK_EXTRAS: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_RESOURCES_BIG: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_NOT_CACHED: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_DEBUG_CONSOLE: 'false'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_MSYS2: * 'true'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_MSYS2_DIR: 'C:\\msys64\\mingw64'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_MSYS2_ARCH: * 'amd64'" time="2023-10-20T14:57:44-04:00" level=info msg="QT_MSYS2_STATIC: * 'true'"
我不知道从哪里开始。我尝试重新安装 msys2 版本的 zstd 库,但就是这样。
我想我已经解决了我的问题。 recipe/qt 的文档指出,如果您想编译静态应用程序,则不必使用 msys2 来设置/安装绑定或部署/编译您的应用程序。我在 VSCode 中使用命令提示符的运气不太好。仅使用 msys2 设置/安装绑定以及编译我的应用程序,我就获得了更加一致的成功。似乎通过 VScode 中的默认命令提示符很难找到 zstd 库。这是我的猜测。
Atas ialah kandungan terperinci Qtdeploy dalam Go gagal seketika. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!