Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pure-go sqlite lib #35

Closed
gsxhnd opened this issue Mar 12, 2021 · 5 comments · May be fixed by #161
Closed

Use pure-go sqlite lib #35

gsxhnd opened this issue Mar 12, 2021 · 5 comments · May be fixed by #161
Assignees

Comments

@gsxhnd
Copy link

gsxhnd commented Mar 12, 2021

Describe the feature

github.com/mattn/go-sqlite3 this lib using c, cgo is not support CROSS_COMPILE

Motivation

@cure
Copy link

cure commented Apr 26, 2021

This library may be a good candidate: http://modernc.org/sqlite (cgo-free).

@axetroy
Copy link

axetroy commented Jul 25, 2021

cgo is really annoying

@jmwielandt
Copy link

+inf!!

I can't use it on windows. It throws me this error:

PS > go get -u gorm.io/driver/sqlite
# github.com/mattn/go-sqlite3
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%

@rittneje
Copy link

rittneje commented Nov 3, 2021

Just to clarify some points here:

  1. cgo supports cross-compilation. However you need a proper C cross-compiler for it to work. It's admittedly non-trivial, but not impossible. You may also be able to leverage docker to make this simpler.
  2. cgo is supported on Windows. But again, you need a C compiler. From what I hear, MinGW usually works well.
  3. Using a C-to-Go transpiled library is not without risk. So it might be nice to give people a choice, either via a separate module, or via a build tag.

@jinzhu
Copy link
Member

jinzhu commented Nov 30, 2021

"modernc.org/sqlite" doesn't pass our tests, would consider making the change if there are any other choices.

@jinzhu jinzhu closed this as completed Nov 30, 2021
aymanbagabas added a commit to aymanbagabas/sqlite that referenced this issue Jul 5, 2023
This implements a pure-go alternative driver whenever CGO_ENABLED=0

Related: go-gorm#93
Fixes: go-gorm#35
Fixes: go-gorm#72
Fixes: go-gorm#77
Fixes: go-gorm#160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants