go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Addtional build info for readme.md

Open sosoyososo opened this issue 5 years ago • 1 comments

Issues like https://github.com/mattn/go-sqlite3/issues/384 related to cross compiling, i saw so many people run into it, making it clear in readme.md may be more effective.

MacOS compile for liunx 64:

  1. install [http://crossgcc.rts-software.org/download/gcc-4.8.1-for-linux32-linux64/gcc-4.8.1-for-linux64.dmg]gcc-4.8.1-for-linux32-linux64
  2. build as usual env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=/usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-gcc go build

Just a thought, And other platform compiling method can be welcom ^_^

sosoyososo avatar Mar 30 '20 04:03 sosoyososo

Cross-compiling C code (and by extension, cgo code) is tricky because the choice of C compiler depends on both the OS (Windows/Linux/Mac) and architecture (x86, x64, arm) of both the host and target. On top of that, there are multiple flavors of compilers for a given combination. I don't think listing all of them is feasible. But I do think it would be helpful to more thoroughly explain what a cross-compiler is and why it is needed, and list out some of the more common options. It would also be helpful to mention using docker as a means of "cross-compiling" (at least when targeting Linux).

rittneje avatar Apr 04 '20 03:04 rittneje