Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Cairo pkgconfig requires xcb-shm package which is not installed #14123

Closed
adammw opened this issue Aug 11, 2012 · 22 comments
Closed

Cairo pkgconfig requires xcb-shm package which is not installed #14123

adammw opened this issue Aug 11, 2012 · 22 comments

Comments

@adammw
Copy link
Contributor

adammw commented Aug 11, 2012

Running PKG_CONFIG_PATH=brew --prefix cairo/lib/pkgconfig pkg-config --cflags --print-errors cairo produces:

Package xcb-shm was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcb-shm.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xcb-shm', required by 'cairo', not found
@adammw
Copy link
Contributor Author

adammw commented Aug 11, 2012

My bad. They're in /opt/X11/lib/pkgconfig

@adammw adammw closed this as completed Aug 11, 2012
@MikeMcQuaid
Copy link
Member

Does this break any software?

@adammw
Copy link
Contributor Author

adammw commented Aug 11, 2012

Not that I know of. I was writing a new formula, so I was getting this error and not understanding what's going on. Then I figured out that xcb-shm and other similar things have their pkg-config not on the default pkg-config search path, and that the proper way to get them included in the search path is to depends_on :x11

@MikeMcQuaid
Copy link
Member

Can you see if this was fixed by by c21552a by any chance? It doesn't matter if it wasn't but just curious.

@Nek
Copy link

Nek commented Sep 5, 2012

It does break compilation of mypaint from sources (it is not on brew yet).

@jacknagel
Copy link
Contributor

If cairo is built with X support (the default), it will require this package. You can put your X11 pkgconfig directory (either /opt/X11/libpkgconfig or /usr/X11/lib/pkgconfig) on PKG_CONFIG_PATH as well so that it can find the libs. This is done automatically by Homebrew, but you'll have to do it manually if your are using cairo in your own software. You can also build it with "--without-x" if you don't need it, though e.g. gtk+ requires it.

Eventually the default will be flipped to "without-x", when my deps branch lands with support for passing options to deps.

@Nek
Copy link

Nek commented Sep 5, 2012

I've tried doing this but it didn't help.

But thanks for the info. At least I know the problem is outside brew's packages handling.
Looks like the cause lies within mypaint's scons configuration.

On Wednesday, September 5, 2012 at 21:23 , Jack Nagel wrote:

If cairo is built with X support (the default), it will require this package. You can put your X11 pkgconfig directory (either /opt/X11/libpkgconfig or /usr/X11/lib/pkgconfig) on PKG_CONFIG_PATH as well so that it can find the libs. This is done automatically by Homebrew, but you'll have to do it manually if your are using cairo in your own software. You can also build it with "--without-x" if you don't need it, though e.g. gtk+ requires it.
Eventually the default will be flipped to "without-x", when my deps branch lands with support for passing options to deps.


Reply to this email directly or view it on GitHub (#14123 (comment)).

@alaboszhang
Copy link

thanks adammw!!!

i coyped all /opt/X11/lib/pkgconfig/*.pc to /usr/local/lib/pkgconfig on my mac

then be ok!

@eelcocramer
Copy link
Contributor

I was trying to 'npm install canvas' (https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX). Canvas requires cairo. The installation of canvas fails because of the package 'xcb-shm', required by 'cairo', was not found.

I fixed this issue by copying the files like the above comment suggests and this fixes the issue but this isn't an elegant solution.

@adammw
Copy link
Contributor Author

adammw commented Sep 21, 2012

Copying pkgconfig files is not a good idea. Symlinking is better but still not brilliant. I've just exported /opt/X11/lib/pkgconfig in my PKG_CONFIG_PATH in .bashrc and it seems to work fine now when manually building things.

@eelcocramer
Copy link
Contributor

Much better. Thanks.

@ozataman
Copy link

@alaboszhang thanks for that pkgconfig tip - helped me finish "waf configure" step when installing py2cairo

@JoeOsborn
Copy link

The fceux formula wants /opt/X11/lib/pkgconfig in PKG_CONFIG_PATH too. Should that be part of the X11 installation process, or something? An advice, at least (if it's not already)?

@jhgorse
Copy link
Contributor

jhgorse commented Apr 11, 2013

Just for the record, the pkg-config path for linking to Cairo things, such as for a gtk-engine for a theme, went a little like this before running ./configure

setenv PKG_CONFIG_PATH "brew --prefix cairo/lib/pkgconfig:/usr/local/opt/pixman/lib/pkgconfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/X11/lib/pkgconfig"

This thread popped up on Google when I got stumped on xcb-shm. Cheers.

@Josh-Tilles
Copy link
Contributor

+1 for "This thread popped up on Google when I got stumped on xcb-shm."
And —what the heck— +1 for the "Cheers." too. =P

(I, too, was briefly baffled by an error, but this page proved useful to me and I solved the problem.)

Specifically, I was trying to install the supporting software for The Haskell School of Expression with cabal install soegtk. I mention that only to lay a Google breadcrumb for anyone else who tries to do the same in the future.

@MylesBorins
Copy link
Contributor

I know this was closed a little while ago but I ran into this issue this evening trying to install canvas via npm....
This ended up being solved by manually exporting the PKG_CONFIG_PATH with the following command

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

This is not a particularly elegant solution imho

@konrad-gibaszewski
Copy link

Still while installing canvas via npm manual export of export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig is needed.

@zsitro
Copy link

zsitro commented Dec 13, 2013

+1 for @thealphanerd

@codazzo
Copy link

codazzo commented Dec 21, 2013

Thanks @thealphanerd !

@mitar
Copy link

mitar commented Feb 15, 2014

But files from /opt/X11/lib/pkgconfig are those installed by xquartz and not those from Homebrew. So you get a version of Cairo installed by xquartz and not one from Homebrew.

@gilesbutler
Copy link

Same issue trying to install css-sprite which depends on canvas. This fixed it for me as well:
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

I tried installing Cairo through Homebrew first so I presume I have 2 copies of it installed as the above comment mentions its installed by xquartz as well.

Will this solution hold up in the long term or could updates break it?

@mikatalk
Copy link

Thanks @adammw !!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests