Native compilation with ICU for Apple Silicon fails
Spaider opened this issue · 1 comments
Spaider commented
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.
rittneje commented
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