Skip to content

Cross platform builds? #10

@sudo-suhas

Description

@sudo-suhas

When I try to cross compile my project which uses go-sqlite-lite, I get the following output:

➜ GOOS=linux GOARCH=amd64 go build -o bin/application ./cmd/rgserver
extern/sqlite/sqllite_reader.go:8:2: build constraints exclude all Go files in <GOPATH>/go/src/my-company-domain.in/modules/revgeo/vendor/github.com/bvinc/go-sqlite-lite/sqlite3

My understanding is that this problem originated from use of CGO. I solved it by using https://github.com/karalabe/xgo (https://github.com/mitchellh/gox did not work):

xgo -targets=linux/amd64 ./cmd/rgserver
Checking docker installation...
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:21:31 2018
 OS/Arch:           darwin/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:29:02 2018
  OS/Arch:          linux/amd64
  Experimental:     true

Checking for required docker image karalabe/xgo-latest... found.
Cross compiling my-company-domain/modules/revgeo/cmd/rgserver...
Building locallymy-company-domain/modules/revgeo/cmd/rgserver...
Compiling for linux/amd64...
Cleaning up build environment...

Do you think it would make sense to add a note to the readme regarding this?

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