go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Native compilation with ICU for Apple Silicon fails

Open Spaider opened this issue 2 years ago • 1 comments

I'm relatively new to Golang and not sure if I get the whole picture. This is the reason I decided to create an issue but not MR yet.

I'm trying to compile go-sqlite3 with ICU extension on Apple M1 chip. It fails because #cgo directive in sqlite3_opt_icu.go specifies lib and include directories under /usr/local/opt which is supposed to be Homebrew root. But this is not a case for M1/M2 chips. Homebrew uses /opt/homebrew/opt on those machines.

Spaider avatar Jul 27 '22 16:07 Spaider

I believe you can change it like so:

#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/icu4c/include
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/icu4c/lib
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/icu4c/include
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/icu4c/lib

rittneje avatar Jul 27 '22 17:07 rittneje