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

cannot cross compile with sqlite support #78

Open
caseylucas opened this issue May 31, 2017 · 1 comment
Open

cannot cross compile with sqlite support #78

caseylucas opened this issue May 31, 2017 · 1 comment

Comments

@caseylucas
Copy link

First, thanks for sql-migrate. It's a great tool. We have been using it so far with success inside docker containers, but because sqlite can't cross compile, we've had to write custom mains (using sql-migrate in library form without sqlite included). Is there possibly some strategy (besides just forking and commenting out sqlite) that could be used to allow cross compiles of the main sql-migrate program when we don't need sqlite support. I'm compiling from mac. See also mattn/go-sqlite3#384

Example of failed compile:

GOOS=linux GOARCH=amd64 go build -o casey-test sql-migrate/*.go
# github.com/mattn/go-sqlite3
../../mattn/go-sqlite3/sqlite3_go18.go:18: undefined: SQLiteConn
../../mattn/go-sqlite3/sqlite3_go18.go:26: undefined: SQLiteConn
../../mattn/go-sqlite3/sqlite3_go18.go:27: undefined: namedValue
../../mattn/go-sqlite3/sqlite3_go18.go:29: undefined: namedValue
../../mattn/go-sqlite3/sqlite3_go18.go:35: undefined: SQLiteConn
../../mattn/go-sqlite3/sqlite3_go18.go:36: undefined: namedValue
../../mattn/go-sqlite3/sqlite3_go18.go:44: undefined: SQLiteConn
../../mattn/go-sqlite3/sqlite3_go18.go:49: undefined: SQLiteConn
../../mattn/go-sqlite3/sqlite3_go18.go:54: undefined: SQLiteStmt
../../mattn/go-sqlite3/sqlite3_go18.go:63: undefined: SQLiteStmt
../../mattn/go-sqlite3/sqlite3_go18.go:36: too many errors

We don't actually use sqlite and if you comment out this line below, the cross compile works.

diff --git a/sql-migrate/config.go b/sql-migrate/config.go
index 6790606..76af76d 100644
--- a/sql-migrate/config.go
+++ b/sql-migrate/config.go
@@ -14,7 +14,7 @@ import (

        _ "github.com/go-sql-driver/mysql"
        _ "github.com/lib/pq"
-       _ "github.com/mattn/go-sqlite3"
+//     _ "github.com/mattn/go-sqlite3"
 )

 var dialects = map[string]gorp.Dialect{
@rishi8313
Copy link

compilation does work after commenting out the import but the application doesn't run and throws error.

"forgot to import package"

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

No branches or pull requests

2 participants