gpt4 book ai didi

go - 无法为 golang 构建 magick

转载 作者:IT王子 更新时间:2023-10-29 02:04:49 28 4
gpt4 key购买 nike

我正在关注这个document用于构建 Go Imagick 库。

当我运行以下命令时

go build -tags no_pkgconfig imagick

它抛出以下异常:

# imagick
src/imagick/affine_matrix.go:8:29: fatal error: wand/MagickWand.h: No such file or directory
compilation terminated

现在要解决这个问题,我还按照许多人的建议安装了以下软件包来解决错误。但它也没有用。

sudo apt-get install libmagickwand-dev libmagickcore-dev imagemagick

此外,当我运行 go build imagick它抛出以下错误:

# imagick
could not determine kind of name for C.FlattenAlphaChannel
could not determine kind of name for C.RemoveAlphaChannel

pkg-config --cflags --libs MagickWand 的输出给出了正确的输出

-fopenmp -I/usr/include/ImageMagick  -lMagickWand -lMagickCore

ImageMagick 仅安装到此路径(/usr/include/ImageMagick)。

最佳答案

他们的文档 mention no_pkgconfig 必须与手动设置的 GCO_CFLAGSCGO_LDFLAGS 一起使用。所以这样的事情应该有效:

export CGO_CFLAGS="$(pkg-config --cflags MagickWand)"
export CGO_LDFLAGS="$(pkg-config --libs MagickWand)"
go build -tags no_pkgconfig

关于go - 无法为 golang 构建 magick,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34764612/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com