rubenv / rubenv/sql-migrate

cannot cross compile with sqlite support

Open
#78 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.4k
Forks
292
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/mattn/go-sqlite3/issues/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{

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with sql-migrate/config.go and reproduce the reported GOOS=linux GOARCH=amd64 build command from the issue. Determine how the main program can be built without requiring SQLite support, while preserving SQLite use when needed; done means the cross-compilation command succeeds without commenting out the driver import.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sqlite
Domain
build-system, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.