3

I am following this document for building the Go Imagick library.

When i ran the following command

go build -tags no_pkgconfig imagick

It throws the following exception :

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

Now to resolve that i have also installed the following packages as many people suggested to resolve the error. But it didn't work either.

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

Moreover, when i run go build imagick It throws the following error :

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

Output of pkg-config --cflags --libs MagickWand gives the correct output

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

ImageMagick is installed to this path(/usr/include/ImageMagick) only.

Naresh
  • 5,073
  • 12
  • 67
  • 124
  • This is being tracked by issue [#68](https://github.com/gographics/imagick/issues/68). Once I confirm and commit a fix, I will type up an answer explaining why this is occurring. – jdi Jan 15 '16 at 22:04

2 Answers2

2

Their docs mention that no_pkgconfig must be used with manually set GCO_CFLAGS and CGO_LDFLAGS. So something like this should work:

export CGO_CFLAGS="$(pkg-config --cflags MagickWand)"
export CGO_LDFLAGS="$(pkg-config --libs MagickWand)"
go build -tags no_pkgconfig
Ainar-G
  • 34,563
  • 13
  • 93
  • 119
  • I am still getting the error `could not determine kind of name for C.FlattenAlphaChannel could not determine kind of name for C.RemoveAlphaChannel` – Naresh Jan 14 '16 at 06:53
  • What is your OS and Go version? My solution works for your original error, but I cannot reproduce these. – Ainar-G Jan 14 '16 at 09:08
  • ubuntu 12.04 and go1.5.2.linux-386 – Naresh Jan 14 '16 at 09:40
  • @Naresh Sorry, I'm on 14.04 and can't reproduce. The package maintainer has given [this example](https://github.com/gographics/imagick/issues/24#issuecomment-66534047) in the issues. If this doesn't help either you might try to raise a new issue about this. – Ainar-G Jan 15 '16 at 09:07
  • 1
    I'm a maintainer of the imagick bindings. Please refer to the issue tracker, [#68](https://github.com/gographics/imagick/issues/68) – jdi Jan 15 '16 at 22:04
1

As mentioned on #68 of the issue tracker, you are using way too old of a version of ImageMagick, which predates the versions that were tested for the master branch. Your Linux distro is older than the current available stable release.

You should manually install a newer ImageMagick, and remove the, one from apt. Or use some solution that allows you to manage multiple versions.

jdi
  • 90,542
  • 19
  • 167
  • 203