textileio / go-textile

[DEPRECATED] Textile is a set of tools and infrastructure for building composable apps and services on the IPFS network
https://textile.io
MIT License
357 stars 43 forks source link

Can't `textile init` on ARM Linux #805

Open flyskywhy opened 5 years ago

flyskywhy commented 5 years ago

Describe the bug When run textile init -s SUo2u6ngf3mCqqzNN8ZCGAdusQ4pcaAomzagVUCaFY6tnAvY with arm version textile (0.1.11 ~ 0.2.3), it print the error

initialize failed: sql: unknown driver "sqlite3" (forgotten import?)

To Reproduce Steps to reproduce the behavior:

  1. Download go-textile_v0.2.3_linux-arm.tar.gz from https://github.com/textileio/go-textile/releases
  2. run textile init -s SUo2u6ngf3mCqqzNN8ZCGAdusQ4pcaAomzagVUCaFY6tnAvY on a ARM linux board
  3. See error

Expected behavior No such error.

Additional context Maybe need CGO_ENABLED=1 when compiling? Ref to Cross platform build failed and Cross compiling fails .

sanderpick commented 5 years ago

Perhaps we need CGOENABLED=1 here with gox: https://github.com/textileio/go-textile/blob/master/.circleci/config.yml#L67

I'll try that on the next master build and point you to a build to try.

flyskywhy commented 5 years ago

If just

CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc go build -ldflags "-extldflags -static -w $(FLAGS)" -i -o textile textile.go

in Makefile, still initialize failed: sql: unknown driver "sqlite3" (forgotten import?)

Ref to https://stackoverflow.com/a/47514836/6318705 , run

CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 go get github.com/mattn/go-sqlite3

and then make build, and the textile init runs well on ARM linux.

////////////////////////////////////////////////////////////////

A strange thing left: then I delete ~/go/ , then make setup again, and no need to

CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 go get github.com/mattn/go-sqlite3

just

CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc go build -ldflags "-extldflags -static -w $(FLAGS)" -i -o textile textile.go

the textile init still runs well on ARM linux.

sanderpick commented 5 years ago

Ok, cool. I'll see what happens with gox