sql-migrate icon indicating copy to clipboard operation
sql-migrate copied to clipboard

Unable to build with CGO_ENABLED=0

Open risentveber opened this issue 4 years ago • 3 comments

In my docker file:

FROM golang:1.13-alpine

RUN apk update && apk add postgresql git gcc libc-dev
ENV CGO_ENABLED=0
RUN go get github.com/rubenv/sql-migrate/...

This fails with the error:

# github.com/mattn/go-sqlite3
src/github.com/mattn/go-sqlite3/sqlite3_opt_preupdate.go:12:16: undefined: SQLiteConn

Also, see https://github.com/mattn/go-sqlite3/issues/327

risentveber avatar Sep 11 '19 10:09 risentveber

Well, I'm fairly certain that CGO is required as sqlite3 is written in C

dancompton avatar Sep 17 '19 18:09 dancompton

Correct!

Note: that only applies to the command-line utility. No database driver is included if you use it as a library, so it works perfectly well without CGO.

rubenv avatar Sep 17 '19 19:09 rubenv

327 states CGO_ENABLED=1 is required in order to compile properly.

nektro avatar Nov 09 '19 22:11 nektro