Skip to content

Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. #855

@piotrkochan

Description

@piotrkochan

go-sqlite3 - tag v1.14.3

I'm building app in the goreleaser in docker environment. I read on README:

If you want to build your app using go-sqlite3, you need gcc. However, after you have built and installed go-sqlite3 with go install github.com/mattn/go-sqlite3 (which requires gcc), you can build your app without relying on gcc in future.

I'm running:

CGO_ENABLED=1 go install github.com/mattn/go-sqlite3
goreleaser --snapshot --rm-dist

goreleaser.yml:

builds:
  binary: [...]
  env:
  - CGO_ENABLED=0
  goarch:
    - amd64
  goos:
  - linux

and the error is:

./myapp
2020-09-17T14:24:42.648+0200    INFO    app/db.go:15    using database ./app.sqlite
panic: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions