go-gorm / sqlite

GORM sqlite driver
MIT License
179 stars 184 forks source link

Go build failed #142

Closed patricknjenga closed 1 year ago

patricknjenga commented 1 year ago

SqLite Error during build. Tested on docker alpine 3.17, RHEL Linux 8 and Suse Linux 12.5 Cannot replicate in playground as it fails in build.

[builder 7/7] RUN go build -o main:

0 11.77 # gorm.io/driver/sqlite

0 11.77 /go/pkg/mod/gorm.io/driver/sqlite@v1.5.0/error_translator.go:9:35: undefined: sqlite3.ErrNoExtended

0 11.77 /go/pkg/mod/gorm.io/driver/sqlite@v1.5.0/error_translator.go:14:36: undefined: sqlite3.Error

patricknjenga commented 1 year ago

Fails on version 1.5.0 Version 1.4.4 build passes

LoveQSYang commented 1 year ago

Same issue Fails on version 1.5.0, build in docker golang:1.19-alpine

# gorm.io/driver/sqlite
/go/pkg/mod/gorm.io/driver/sqlite@v1.5.0/error_translator.go:9:35: undefined: sqlite3.ErrNoExtended
/go/pkg/mod/gorm.io/driver/sqlite@v1.5.0/error_translator.go:14:36: undefined: sqlite3.Error
a631807682 commented 1 year ago

Might be related to https://github.com/go-gorm/sqlite/pull/136, would you like to take a look? @saeidee

saeidee commented 1 year ago

Yes sure I will have a look

pivotal-marcela-campo commented 1 year ago

Same here, cross compilation fails, targetting same architecture seems to work well in my case.

saeidee commented 1 year ago

Seems that go-sqlite3 is a cgo package and CGO_ENABLED=1 flag is required plus it will require new compilers like cross-C-compiler to be installed on the machine, however, I don't think it should be a concern of gorm, so I going to reimplement the error translating without depending on go-sqlite3 package.

Here is the fix PR: https://github.com/go-gorm/sqlite/pull/143

saeidee commented 1 year ago

Since the fix PR(https://github.com/go-gorm/sqlite/pull/143) has been merged to the master I am closing this issue, please wait for the next release.