Go-sqlite3: Cross compile failing

Created on 2 Dec 2016  路  4Comments  路  Source: mattn/go-sqlite3

Cross compile from osx -> linux is failing

$> env GOOS=linux GOARCH=arm GOARM=7 go build main.go

# github.com/mattn/go-sqlite3
../github.com/mattn/go-sqlite3/tracecallback_noimpl.go:8: undefined: SQLiteConn

go env

go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/apertureless/.go"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sh/zh7wtckx5tvgy8xwyqr8y8p80000gn/T/go-build395604859=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

Most helpful comment

FWIW, this 'used' to work with this package, building on Windows host and building for Windows, Linux and Darwin.
I can now only build natively on every platform.

All 4 comments

Do you have cross C compiler for linux?

Oh now I see. You have C bindings in there. I was using jinzhu/gorm package, which uses your package for sqlite.

Yeah the missing c cross compiler, will be the problem. Thanks.

FWIW, this 'used' to work with this package, building on Windows host and building for Windows, Linux and Darwin.
I can now only build natively on every platform.

@mattn can you give more details on what's the recommended approach for a C cross compiler for Linux?

Also, what about the other way .. building on Linux, but creating binaries for OSX?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KrisCarr picture KrisCarr  路  11Comments

jackhu1990 picture jackhu1990  路  11Comments

dylanlyu picture dylanlyu  路  6Comments

korovkin picture korovkin  路  12Comments

barnettZQG picture barnettZQG  路  7Comments