Labels

biology (1) compilation (1) couchdb (2) database (2) golang (1) google maps (1) mapnificent (1) nosql (2) optimization (1) public transit (1) python (2) randomization (1) sea snake (1) sqlite (1)
Showing posts with label compilation. Show all posts
Showing posts with label compilation. Show all posts

Friday, April 6, 2012

Compiling (for Go) github.com/gwenn/gosqlite

In case you received a compilation error (for example, when fetching the package with `go get`) indicating that the symbol sqlite3_table_column_metadata could not be found, then you're likely linking against a sqlite build that does not implement the full C API that gosqlite is expecting.

(the rest of this guide assumes a Unix-like environment)

One solution would involve stamping out meta.go, and everything that may rely on it.

A most likely simpler solution involves locally building sqlite to include this functionality. To do this in a minimum number of steps, download the 'sqlite-autoconf' tarball from , unpack it, and run:

`CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA" ./configure`

At this point, the typical `make && make install` process should work as expected to produce the needed library. Since this build of sqlite probably ended up in /usr/local, you'll, at a minimum, need to set cgo's linker environment variable:

`export CGO_LDFLAGS="-L/usr/local/lib -lsqlite3"`

After doing so, rerun the `go get` or `go install` command that had previously failed: hopefully it will now build without error.