Both Mac and Linux have the following error.
go build --tags "icu"
# github.com/mattn/go-sqlite3
.../github.com/mattn/go-sqlite3/sqlite3-binding.c:166752:10: fatal error: 'unicode/utypes.h' file not found
Here are some additional information:
go env
GOARCH="amd64"
GOBIN="
GOEXE="
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/m7258/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC = "clang"
GOGCCFLAGS="-fPIC-m64-pthread-fno-care-diagnostics-Qunused-arguments-fmessage-length=0-fdebug-prefix-map=/var/folder/d2/y6ws0ldx5vn5tk1h5cjxh0000gn/T/go-build-gud-gud-gud-gud-gold34=0/gud -
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG = "pkg-config"
CGO_CFLAGS="-g-O2"
CGO_CPPFLAGS="
CGO_CXXFLAGS="-g-O2"
CGO_FFLAGS="-g-O2"
CGO_LDFLAGS="-g-O2"
catmain.go
package main
import(
"database/sql"
"log"
_"github.com/mattn/go-sqlite3"
)
funcmain(){
db,err:=sql.Open("sqlite3", ":memory:")
if err!=nil{
log.Fatal(err)
}
prefer db.Close()
}
I'm a questioner.Comments cannot be added, so I will comment from the answer.
It's solved.
Thank you metropolis and Mattn.
OS:Mac
brew install icu4c
brew link icu4c -- force
Reference
https://stackoverflow.com/questions/33259191/installing-libicu-dev-on-mac
Operating System: Linux (Debian)
apt-get install libicu-dev
To build go-sqlite3 with icu, you must have installed the icu library for the build.
© 2024 OneMinuteCode. All rights reserved.