gpt4 book ai didi

导入 sqlite3 驱动程序时出现问题

转载 作者:IT王子 更新时间:2023-10-29 01:14:26 25 4
gpt4 key购买 nike

所以我一直在尝试将以下sqlite3驱动程序集成到我的Go项目中; https://github.com/mattn/go-sqlite3 , 使用命令;

go get github.com/mattn/go-sqlite3 && go install github.com/mattn/go-sqlite3

按照自述文件中的说明。不幸的是,没有任何成功 - 在运行命令并尝试使用 import("github.com/mattn/go-sqlite3") 导入驱动程序后,我留下了两个非常小的特定错误,我假设与 gcc 编译器有关?

# command-line-arguments
/usr/bin/ld: $WORK/b001/_pkg1_.a(_x009.o): undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

这是 go env 的输出,我已经安装了 sqlite3 和 GCC;

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/maciej/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/maciej/go"
GORACE=""
GOROOT="/usr"
GOTMPDIR=""
GOTOOLDIR="/usr/libexec/gcc/x86_64-redhat-linux/8"
GCCGO="/usr/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build343666347=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

sqlite3 -version
3.22.0 2018-01-22 18:45:57
gcc version 8.2.1 20181105 (Red Hat 8.2.1-5) (GCC)

出于好奇,我尝试使用 TDM gcc 5.1.0 在 Windows 10 上运行完全相同的过程并且它运行完美,我将非常感谢关于我的问题的任何建议,谢谢。

最佳答案

我在使用 gobuffalo 时遇到了同样的问题。解决方法:

第 1 步:转到以下页面:http://tdm-gcc.tdragon.net/

第 2 步:下载 TDM64 包

第 3 步:启动 TDM64 bundle 并打开安装程序

我写了一篇关于此的博文:https://blog.gobuffalo.io/install-buffalo-on-windows-10-e08b3aa304a3

关于导入 sqlite3 驱动程序时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53380175/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com