go version go1.19.3 windows/amd64
I’m trying to use this package for sqlite with encrypted database.
https://github.com/CovenantSQL/go-sqlite3-encrypt#installation
It states I require “gcc” (no idea what that is).
So I download “GCC 12.2.0” Winx64 version and extract the “mingw64” folder to root of C
https://winlibs.com/#download-release
I then add the bin folder path in there to my system path list.
I did this:
go install github.com/CovenantSQL/go-sqlite3-encrypt
I have this in the “go env” list as instructed:
CGO_ENABLED=1
When i attempt to do: “go run main.go” I now get this and I have no idea what it means. Please assist - thanks.
sqlite3-binding.c: In function 'sqlite3SelectNew':
sqlite3-binding.c:121469:10: warning: function may return address of local variable [-Wreturn-local-addr]
121469 | return pNew;
| ^~~~
sqlite3-binding.c:121431:10: note: declared here
121431 | Select standin;
| ^~~~~~~
# command-line-arguments
S:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\[username]\AppData\Local\Temp\go-link-138338206\000015.o: in function `_cgo_preinit_init':
\\_\_\runtime\cgo/gcc_libinit_windows.c:40: undefined reference to `__imp___iob_func'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\[username]\AppData\Local\Temp\go-link-138338206\000015.o: in function `x_cgo_notify_runtime_init_done':
\\_\_\runtime\cgo/gcc_libinit_windows.c:105: undefined reference to `__imp___iob_func'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\[username]\AppData\Local\Temp\go-link-138338206\000015.o: in function `_cgo_beginthread':
\\_\_\runtime\cgo/gcc_libinit_windows.c:149: undefined reference to `__imp___iob_func'
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\[username]\AppData\Local\Temp\go-link-138338206\000016.o: in function `x_cgo_thread_start':
\\_\_\runtime\cgo/gcc_util.c:18: undefined reference to `__imp___iob_func'
collect2.exe: error: ld returned 1 exit status
package main
import (
"database/sql"
"log"
_ "github.com/CovenantSQL/go-sqlite3-encrypt"
)
func main() {
db, err := sql.Open("sqlite3", "file:Directory.db?_crypto_key=blahblah")
if err != nil {
log.Fatal(err)
}
defer db.Close()
}