imagick: invalid flag in pkg-config --cflags: -Xpreprocessor
export CGO_CFLAGS_ALLOW='-Xpreprocessor'
解决思路来源,
go build gopkg.in/gographics/imagick.v2/imagick: invalid flag in pkg-config --cflags: -fopenmp
This is the workaround, from what the ticket says:
export CGO_CFLAGS_ALLOW='-fopenmp'
The failing flag is a compile flag, so you need to manually whitelist it.
go run -tags no_pkgconfig main.go
You can't do this without telling it explicit CGO_CFLAGS and CGO_LDFLAGS. That turns off pkg-config which means its now not finding ImageMagick
Closing this since the problem relates to the cgo whitelist in the latest Go release.