在Mac OS X 1.7.5 / Lion上
我正在尝试使用自制软件安装cairo包
brew install cairo => PASSED
==> Downloading http://cairographics.org/releases/cairo-1.12.16.tar.xz
Already downloaded: /Library/Caches/Homebrew/cairo-1.12.16.tar.xz
==> ./configure --prefix=/usr/local/Cellar/cairo/1.12.16 --with-x --enable-gobject=yes
==> make install
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.
Mac OS X already provides this software in versions before Mountain Lion.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/cairo/lib
CPPFLAGS: -I/usr/local/opt/cairo/include
==> Summary
/usr/local/Cellar/cairo/1.12.16: 105 files, 8.0M, built in 2.5 minutes
当我尝试编译我的代码时,我仍然得到这个:
+++ Precompile
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
Package 'cairo', required by 'pangocairo', not found
所以我相应调整了PKG_CONFIG_PATH
PKG_CONFIG_PATH=/usr/local/opt/cairo/lib/pkgconfig/:/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig/:
(来源.bash_profile)
尝试再次编译,但我得到完全相同的错误。
验证该文件存在于该pkgconfig目录中......它是。
ls /usr/local/opt/cairo/lib/pkgconfig/
cairo-fc.pc cairo-gobject.pc cairo-png.pc cairo-quartz-font.pc cairo-script.pc cairo-xcb-shm.pc cairo-xlib-xrender.pc cairo.pc
cairo-ft.pc cairo-pdf.pc cairo-ps.pc cairo-quartz.pc cairo-svg.pc cairo-xcb.pc cairo-xlib.pc
这里出了什么问题?
更新
cairo.pc位于我系统中的位置。我已经尝试在我的pgg配置路径中使用每个位置但没有成功
find /usr -name cairo.pc
/usr/local/Cellar/cairo/1.12.16/lib/pkgconfig/cairo.pc
/usr/X11/lib/pkgconfig/cairo.pc
pkg-config --variable pc_path pkg-config
/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig
答案 0 :(得分:11)
注意:仅适用于Ubuntu。
解决我的问题更容易。 Ubuntu依赖项没有正确安装,你可以在这里找到说明:
https://github.com/LearnBoost/node-canvas/wiki
这对我有用:
sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
答案 1 :(得分:6)
ln -s /usr/local/Cellar/cairo/1.12.16/lib/pkgconfig/cairo.pc /usr/local/lib/pkgconfig/cairo.pc
解决了我的问题
答案 2 :(得分:4)
我在优胜美地遇到了这个问题,并通过重新安装cairo修复了它。
// Import the Express module
var express = require('express');
// Create a new Express Instance
var app = express();
答案 3 :(得分:3)
您可以使用PKG_CONFIG_PATH
。即:
PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.12.16/lib/pkgconfig ./configure ....
答案 4 :(得分:0)
要调试和修复此问题:
运行 pkg-config --libs cairo
。如果它说下面的错误,
那么问题依然存在。
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
要查找 pkg-config
使用的默认搜索路径,请运行:
pkg-config --list-all --debug 2>&1 > /dev/null | grep 'Scanning directory'
如果您在步骤 (1) 中仍然有错误,则输出将不包括包含 cairo.pc
的目录。
找到包含 cairo.pc
的目录。如果您使用 brew 安装 cairo
,通常它在 /opt
下,您可以在其中运行 find /opt -name cairo.pc
使用包含 PKG_CONFIG_PATH
的目录设置 cairo.pc
环境变量。您只能这样做一次:
PKG_CONFIG_PATH=<path containing cairo.pc> <your command>
喜欢PKG_CONFIG_PATH=<path containing cairo.pc> pkg-config --libs cairo
,
或导出环境
export PKG_CONFIG_PATH=<path containing cairo.pc>
然后运行您的命令。