.../github.com/mattn/go-sqlite3/sqlite3-binding.c:166752:10: fatal error: 'unicode/utypes.h' file not found

Asked 2 years ago, Updated 2 years ago, 80 views

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()
}

go sqlite

2022-09-30 20:10

2 Answers

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


2022-09-30 20:10

To build go-sqlite3 with icu, you must have installed the icu library for the build.


2022-09-30 20:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.