2016-01-13 45 views
1

我按照此document構建Go Imagick庫。無法爲golang構建magick

,當我跑以下命令

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)。

+0

這正在通過問題[#68](https://github.com/gographics/imagick/issues/68)進行跟蹤。一旦我確認並進行修復,我將輸入一個答案來解釋爲什麼會發生這種情況。 – jdi

回答

1

由於對問題跟蹤的#68提到,您使用的方式太舊的版本的ImageMagick的,這早測試的主分支版本。您的Linux發行版比當前可用的穩定發行版舊。

您應手動安裝較新的ImageMagick,並從apt中刪除一個。或者使用一些允許您管理多個版本的解決方案。

+0

你能幫我在這裏'http://stackoverflow.com/questions/35550850/lot-的-TEMP-magick-文件創建功能於臨時folder' – Naresh

1

他們的文檔mentionno_pkgconfig必須與手動設置GCO_CFLAGSCGO_LDFLAGS一起使用。所以,這樣的事情應該工作:

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

我仍然收到錯誤'無法確定C.ClattenAlphaChannel的名稱種類不能確定C.RemoveAlphaChannel的名稱種類 – Naresh

+0

什麼是您的操作系統和Go版本?我的解決方案適用於您的原始錯誤,但我無法重現這些。 –

+0

ubuntu 12.04和go1.5.2.linux-386 – Naresh