pkg-config sqlite3, Go sqlite3 code stop working after Go upgrade

79 views
Skip to first unread message

Tong Sun

unread,
Dec 16, 2017, 10:51:27 PM12/16/17
to golang-nuts

I found that all my Go sqlite3 code no longer working for me now.


For example, here is a simple Go sqlite3 code, go-sqlite3-test.go, that's been working fine for years. But with my current go1.9.2, it is no longer working. (Confirmed from another machine that go1.8.3 + lastest github.com/mattn/go-sqlite3 works just fine. Both machines have sqlite3 and libsqlite3-0:amd64 installed).


Using go1.9.2, downloading the code into /tmp/go-sqlite3-test, I got:


$ go run go-sqlite3-test.go 
# pkg-config --cflags sqlite3
pkg-config: exec: "pkg-config": executable file not found in $PATH


Having installed pkg-config, in turn I got:


$ go run go-sqlite3-test.go 
# pkg-config --cflags sqlite3
Package sqlite3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `sqlite3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sqlite3' found
pkg-config: exit status 1

$ sudo pkg-config --cflags sqlite3 
Package sqlite3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `sqlite3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sqlite3' found

$ go build 
# pkg-config --cflags sqlite3
Package sqlite3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `sqlite3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sqlite3' found
pkg-config: exit status 1


How to get my Go sqlite3 code working again? Thx


Miki Tebeka

unread,
Dec 16, 2017, 11:43:33 PM12/16/17
to golang-nuts
For some reason pkg-config doesn't know about sqlite3. It can be that sqlite3 is not installed (or not installed properly).

pkg-config looks for sqlite3.pc in some pre-defined libraries (/usr/share/pkgconfig /usr/lib/pkgconfig ...) and as the error message says - you can added other directories to the PKG_CONFIG_PATH environment variable.

Tong Sun

unread,
Dec 17, 2017, 8:08:37 AM12/17/17
to golang-nuts
True -- it turns out that the github.com/mattn/go-sqlite3 was not installed properly and everything works fine after refreshing that.

Thanks Miki!
Reply all
Reply to author
Forward
0 new messages