compile failed when build imagick
Posted: 2017-10-11T06:43:32-07:00
i try to use imagick whick is a wrapped lib for golang.
i installed imagemagick successfully, and i could use tools such as convert or magick to make images as i thought.
however, i would like to use the library name imagick, which is based on the MagickWand for C. i built from the source code to product libraries, and installed it. i run the command: go get gopkg.in/gographics/imagick.v3/imagick, and it can pull the source code, but built failed.
it output :
i tried to see the code in drawing_wand.go, and the source code in module named runtime. the KeepAlive is a function with empty implement:
with informations above, how could i solve the problem i met?
can you anyone help me?
i installed imagemagick successfully, and i could use tools such as convert or magick to make images as i thought.
however, i would like to use the library name imagick, which is based on the MagickWand for C. i built from the source code to product libraries, and installed it. i run the command: go get gopkg.in/gographics/imagick.v3/imagick, and it can pull the source code, but built failed.
it output :
Code: Select all
[userlz@compile ImageMagick]$ go get gopkg.in/gographics/imagick.v3/imagick
# gopkg.in/gographics/imagick.v3/imagick
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:39: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:45: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:85: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:96: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:115: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:125: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:140: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:178: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:186: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:205: undefined: runtime.KeepAlive
../gopath/src/gopkg.in/gographics/imagick.v3/imagick/drawing_wand.go:205: too many errors
Code: Select all
// Mark KeepAlive as noinline so that the current compiler will ensure
// that the argument is alive at the point of the function call.
// If it were inlined, it would disappear, and there would be nothing
// keeping the argument alive. Perhaps a future compiler will recognize
// runtime.KeepAlive specially and do something more efficient.
//go:noinline
// KeepAlive marks its argument as currently reachable.
// This ensures that the object is not freed, and its finalizer is not run,
// before the point in the program where KeepAlive is called.
//
// A very simplified example showing where KeepAlive is required:
// type File struct { d int }
// d, err := syscall.Open("/file/path", syscall.O_RDONLY, 0)
// // ... do something if err != nil ...
// p := &File{d}
// runtime.SetFinalizer(p, func(p *File) { syscall.Close(p.d) })
// var buf [10]byte
// n, err := syscall.Read(p.d, buf[:])
// // Ensure p is not finalized until Read returns.
// runtime.KeepAlive(p)
// // No more uses of p after this point.
//
// Without the KeepAlive call, the finalizer could run at the start of
// syscall.Read, closing the file descriptor before syscall.Read makes
// the actual system call.
func KeepAlive(interface{}) {}
can you anyone help me?