2013-03-13 76 views
0

我想用cgo運行GraphicsMagick。cgo和pkg-config

/* 
#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; 
} 
*/ 

然後我跑 '去安裝',它說:

# 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 

,但我在shell中運行 'pkg配置GraphicsMagick工具 - 配置' 和它的確定。

回答

2

GraphicsMagick-config腳本是一個單獨的程序,而不是pkg-config資源,它解釋了這個問題。

此外,運行帶有非選項參數的pkg-config似乎會失敗,而不打印錯誤消息,這可能會讓您感到困惑。

除了這個腳本,雖然庫確實爲pkg-config安裝了一個GraphicsMagick.pc數據文件。所以你應該能夠讓你的代碼運行:

#cgo pkg-config: GraphicsMagick