Hi, I am relatively new to Go, and while I know compiling a go app for another OS/arch, so long as that app is pure Go, is trivial, eg:
( From a Windows or Linux x86_64 go install)
GOOS=linux GOARCH=arm go build foo
… however, I’m trying to build a go app which uses github.com/mattn/go-sqlite3, which has C native bindings to the SQLite3 DB engine.
I have been reading various blog posts about doing C/C++ bindings in Go but I haven’t had much luck in building this package or its examples for ARM from a Windows or Linux Go installation. I don’t know if it’s something to do with the way this particular package is organized or if I’m just not understanding what has to be in place beforehand.
The situation I’m in is that we have a separate vendor-supplied ARM toolchain that is used for other project-related code in C/C++, and it already builds sqlite3.a or sqlite3.so itself; so I’d like to figure out how, ideally, to just put that pre-built lib in the ‘right spot’ for a go build to pick it up and use with GOARCH=arm GOOS=linux.
Failing that, I guess I’d have to figure out how to convince the build for this particular go project to also build sqlite3, but for ARM not x86.
Are there any tutorials out there that demonstrate best practices for using foreign-built libraries with a go build? Is it as simple as placing the precompiled lib in some magic spot?