I want to run GraphicsMagick with cgo.

/*
#cgo pkg-config: GraphicsMagick-config

#include <magick/api.h>

static int gm(int argc, char **argv) {
    int status;
    status = GMCommand(argc, argv);
    return 1-status;
}
*/

then I run 'go install', it says:

# pkg-config --cflags GraphicsMagick-config
Package GraphicsMagick-config was not found in the pkg-config search path.
Perhaps you should add the directory containing `GraphicsMagick-config.pc'
to the PKG_CONFIG_PATH environment variable
No package 'GraphicsMagick-config' found
exit status 1

but I run 'pkg-config GraphicsMagick-config' in shell and it's ok.

有帮助吗?

解决方案

The GraphicsMagick-config script is a separate program rather than a pkg-config resource, which explains the problem.

Also, running pkg-config with a non-option argument seems to fail without printing an error message, which might have confused you.

In addition to this script though, the library does install a GraphicsMagick.pc data file for pkg-config. So you should be able to get your code running with:

#cgo pkg-config: GraphicsMagick
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top