ubuntu12.04 does not support gobinding

Source: Internet
Author: User
Tags imagemagick drupal

Try to write ImageMagick with gobinding

I use the system is ubutu12.04, previously because the system apt installation missing library files, I use the tar download make install installation, here to a library file has been added to the tar package

http://download.csdn.net/detail/u010026901/7642329

OK, then go to the official docs and GitHub and execute them sequentially

Ubuntu/debian
sudo apt-get install libmagickwand-dev
Common

Check if Pkg-config is able to find the right ImageMagick include and Libs:

pkg-config --cflags --libs MagickWand

Then go get it:

go get github.com/gographics/imagick/imagick  //默认安装在第一个gopath的文件夹下
I simply wrote a demo.

Package Main


Import (
"FMT"
"Github.com/gographics/imagick/imagick"
)


Func Main () {
Imagick. Initialize ()
Defer Imagick. Terminate ()
MW: = Imagick. Newmagickwand ()
Defer MW. Destroy ()
Owl Readimage ("/home/qboxtest/qbox/image/fop_ncgo/src/qbox.us/fop/imgave/samples/sample.jpg")


Height: = Int (MW). Getimageheight ())
Width: = Int (MW). Getimagewidth ())
println (height, width)
PW: = Imagick. Newpixelwand ()
Defer PW. Destroy ()
PW=MW. Getimagepixelcolor (2, 2)//Congratulations here on the problem, after the reason, should be and the TAR package provided library file conflict, compile no problem, the execution of the rest of the dish
Fmt. Println ("xxxx", PW)


r: = pw. Getred ()
G: = pw. Getgreen ()
B: = pw. GetBlue ()
A: = PW. Getalpha ()
println ("xxxxxxx", R, G, B, a)


RGB: = Int (Ten) <<16 | Int (one) <<8 | Int (12)
Fmt. Printf ("0x%06x", RGB)
}

Next i uninstalled the ImageMagick of my own installation and went through the process again, regardless of whether I installed ImageMagick with apt, always error

# command-line-arguments
/usr/bin/ld:cannot find-lmagickwand-6.q16
/usr/bin/ld:cannot find-lmagickcore-6.q16
Collect2:ld returned 1 exit status

The corresponding library files are not found in Usr/lib and Usr/local/lib, there is no path to install, and you cannot find

[Email protected]:~/desktop$ apt-cache Search imagemagic*
Groff-gnu troff text-formatting System
Imagemagick-image Manipulation Programs
Imagemagick-common-image manipulation Programs--infrastructure
imagemagick-dbg-debugging Symbols for ImageMagick
imagemagick-doc-document Files of ImageMagick
inkscape-vector-based Drawing Program
libmagick++-dev-object-oriented C + + interface to imagemagick-development files
libmagick++4-object-oriented C + + interface to ImageMagick
Libmagickcore4-low-level Image Manipulation Library
Libmagickwand4-image Manipulation Library
Libreoffice-office Productivity Suite
Perlmagick-perl interface to the ImageMagick graphics routines
Tex4ht-latex and TeX for Hypertext (HTML)-Executables
Tex4ht-common-latex and TeX for Hypertext (HTML)-Support files
Ctioga-command-line Plotting Utility
DRUPAL6-MOD-IMAGEAPI-IMAGEAPI Module for Drupal 6
Drupal6-mod-imagecache-imagecache Module for Drupal 6

With Dpkg-s magic* view, found that the ubuntu12.04 comes with the library is 6.6.9 version, but gobinding requires more than 6.8

[Email protected]:~/desktop$ dpkg-s magic*
Libmagickcore-dev:/usr/lib/libmagickcore.a
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/gradient.so
Libmagickcore-dev:/usr/include/imagemagick/magick/random_.h
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/html.la
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/ps2.la
Libmagickcore-dev:/usr/include/imagemagick/magick/memory_.h
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/sun.so
Libmagickcore4:/usr/share/imagemagick-6.6.9/english.xml
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/ipl.la
Libmagickcore-dev:/usr/include/imagemagick/magick/policy.h
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/pcx.la
Imagemagick-common:/etc/imagemagick/log.xml
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/sct.la
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/stegano.so
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/sgi.so
Libmagickwand-dev:/usr/include/imagemagick/wand/conjure.h
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/pix.la
Libmagickcore4:/usr/lib/imagemagick-6.6.9/modules-q16/coders/art.so

At this time to compile and found that the compilation but

# Github.com/gographics/imagick/imagick
37:error: ' Flattenalphachannel ' undeclared (first use of this function)
37:error: ' Removealphachannel ' undeclared (first use of this function)

ubuntu12.04 does not support gobinding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.