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.

详细: https://github.com/gographics/imagick/issues/155

posted @ 2022-02-08 13:49  柠檬水请加冰  阅读(386)  评论(0编辑  收藏  举报