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

Fail to build pango #14426

Closed
xuhdev opened this issue Aug 24, 2012 · 50 comments
Closed

Fail to build pango #14426

xuhdev opened this issue Aug 24, 2012 · 50 comments

Comments

@xuhdev
Copy link
Contributor

xuhdev commented Aug 24, 2012


  CCLD   libpango-1.0.la
In file included from pangocairo-fontmap.c:30:
./pangocairo-coretext.h:28:10: fatal error: 'cairo-quartz.h' file not found
#include <cairo-quartz.h>
         ^
1 error generated.
make[4]: *** [libpangocairo_1_0_la-pangocairo-fontmap.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from pangocairo-coretextfont.c:32:
./pangocairo-coretext.h:28:10: fatal error: 'cairo-quartz.h' file not found
#include <cairo-quartz.h>
         ^
1 error generated.
In file included from pangocairo-coretextfontmap.c:28:
./pangocairo-coretext.h:28:10: fatal error: 'cairo-quartz.h' file not found
#include <cairo-quartz.h>
         ^
1 error generated.
make[4]: *** [libpangocairo_1_0_la-pangocairo-coretextfont.lo] Error 1
make[4]: *** [libpangocairo_1_0_la-pangocairo-coretextfontmap.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

It seems that there is a missing dependency.

I am on OS X 10.8 and I have installed xQuatz.

@gmcclure
Copy link

Same problem ...

@DEfusion
Copy link

Same here on mountain lion. Have a clean brew doctor and this is my brew config: https://gist.github.com/3447797

@luxflux
Copy link

luxflux commented Aug 24, 2012

Same for me... Any ideas?

@a-foutoyet
Copy link

Same on my side : OS-X ML (last OS update done) :

In file included from pangocairo-fontmap.c:30:
./pangocairo-coretext.h:28:10: fatal error: 'cairo-quartz.h' file not found

@evanmeng
Copy link

Same problem.
On Mountain Lion.

@BYVoid
Copy link
Contributor

BYVoid commented Aug 24, 2012

Same problem. It seemed that there is no file name 'cairo-quartz.h' in /opt/X11/include/cairo

@mikegray
Copy link

I was able to get pango to build and install correctly by ensuring the pkgconfig for my Homebrew installs was referenced. I added "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig", to the configure command in pango.rb. (/usr/local is my brew --prefix). Give it a shot. From the Homebrew config.log I noticed the main pkgconfig wasn't being referenced and instead /opt/X11/lib/pkgconfig/ was, so this was my route around this issue for now.

@jacknagel
Copy link
Contributor

The main Homebrew pkg-config paths are built into pkg-config when it is compiled, which is why it isn't added to the PKG_CONFIG_PATH variable.

@mikegray
Copy link

When pango fails to find cairo-quartz.h, the Homebrew config.log shows output of pango configure step with this:

ac_cv_env_PKG_CONFIG_PATH_value=/usr/local/Cellar/libffi/3.0.11/lib/pkgconfig:/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/Library/Homebrew/pkgconfig

This does not include any reference to /usr/local/lib/pkgconfig.

@jacknagel
Copy link
Contributor

That's because it is built into the pkg-config binary when pkg-config is compiled. It is not in PKG_CONFIG_PATH.

@jacknagel
Copy link
Contributor

You can do pkg-config --variable pc_path pkg-config to see the built-in paths.

@mikegray
Copy link

Yes, that does look to be true. Yet still, pango without this modification is unable to find cairo on my system - or finds it first in /opt/X11, which does not have cairo-quartz.

@gmcclure
Copy link

Followed mikegray's advice and Pango installed. Thank you! Now I've got a new "'pango/pangoxft.h' file not found" error coming up when I try to install fontforge, but at least there's progress ...

@luxflux
Copy link

luxflux commented Aug 25, 2012

It worked out with @mikegray's workaround. Didn't get an error about pango/pangoxft.h' file not found.

@2bits
Copy link
Contributor

2bits commented Aug 25, 2012

When this sort of thing happens with pkg-config, you brew install -vd pango so that you shell out into the build environment. Then you run the failing pkg-config command with an additional --print-errors so you can determine the real problem.

@evanmeng
Copy link

Follow mikegray's comment I made Pango installed. Then I met new problem when continue to install gtk

When configure, it keeps complain about:

checking Pango flags... configure: error: 
*** Pango not found. Pango built with Cairo support is required
*** to build GTK+. See http://www.pango.org for Pango information.

Not sure whether this is problem of gtk or related with pango build? or cairo build?

Following issue #10421 I also tried

brew unlink pango && brew link pango

not work yet...

build error output:

==> Build Environment
HOMEBREW_VERSION: 0.9.2
HEAD: 4ce8717a18bbec90cc07e07dfa296effabdc7bb4
CPU: 8-core 64-bit sandybridge
OS X: 10.8.1-x86_64    
Xcode: 4.4.1
CLT: 4.4.0.0.1.1249367152
X11: 2.7.2 in /opt/X11
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.8
CPPFLAGS: -I/usr/local/Cellar/libffi/3.0.11/include -I/usr/local/Cellar/gettext/0.18.1.1/include -I/opt/X11/include
LDFLAGS: -L/usr/local/Cellar/libffi/3.0.11/lib -L/usr/local/Cellar/gettext/0.18.1.1/lib -L/usr/local/lib -L/opt/X11/lib
CMAKE_PREFIX_PATH: /opt/X11
MAKEFLAGS: -j8
MACOSX_DEPLOYMENT_TARGET: 10.8
PKG_CONFIG_PATH: /usr/local/Cellar/libffi/3.0.11/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/Library/Homebrew/pkgconfig
ACLOCAL_PATH: /usr/local/Cellar/gettext/0.18.1.1/share/aclocal
OBJC: /usr/bin/clang
PATH: /usr/local/Cellar/libffi/3.0.11/bin:/usr/local/Cellar/gettext/0.18.1.1/bin:/opt/X11/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/Library/Contributions/cmds

Error: Failed executing: ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/gtk+/2.24.11 --disable-glibtest --disable-introspection --disable-visibility PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig (gtk+.rb:26)

@clementbethuys
Copy link

did exactly the same as evanmeng and have the same error.
Then i try to configure directly gtk+
it appears to lack of some library for cairo that are not installable with brew like xcb-shm
they are if fact installed with X11 and adding the pkg config path from /opt/X11 to the legacy pkg-config path of brew
made this work

this entry was usefull to me
#14123

@samueljohn
Copy link
Contributor

I get the same err as originally described (on Xcode-only system here).
Pkg-config for cairo (just reinstalled) does not find fontconfig.

pkg-config --cflags cairo
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
Package 'fontconfig', required by 'cairo', not found

Could that be a reason?

@samueljohn
Copy link
Contributor

@jacknagel you are right about the built-in path:

pkg-config --variable pc_path pkg-config
/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig

The PKG_CONFIG_PATH env var is:
/usr/local/Cellar/libffi/3.0.11/lib/pkgconfig:/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/Library/Homebrew/pkgconfig

Perhaps, the env var takes precedence over the built in defaults here, so the /opt/X11/lib/pkgconfig/cairo.pc is found first. And the cairo of X11 does not have the needed cairo-quartz.h.

And indeed, the opt/X11/include/cairo is added:

pkg-config --cflags cairo
-I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include/libpng15 -I/usr/local/Cellar/glib/2.32.4/include/glib-2.0 -I/usr/local/Cellar/glib/2.32.4/lib/glib-2.0/include -I/usr/local/Cellar/gettext/0.18.1.1/include 

@samueljohn
Copy link
Contributor

So, what to do about it? Add homebrew's pkgcnfig directories (several) in the PKG_CONFIG_PATH before the /opt/X11 stuff?

@clementbethuys
Copy link

samueljohn to resolve this i only exported the PKG_CONFIG_PATH and build it. It worked well

@samueljohn
Copy link
Contributor

@clementbethuys what do you mean ny "exported"? Where did you put the export statement? In the formula, the variable should already be set.
Did you alter the variable?

@clementbethuys
Copy link

you can export in the same terminal before using the command or directly in the recipe i put the X11 before.
It told me couldn't find pango so i "brew unlink pango && brew link pango" and it worked well

@samueljohn
Copy link
Contributor

So what's your var then?
I am asking because my theory was that homebrew's pkgconfig should come first.

@samueljohn
Copy link
Contributor

@h-h please gist such long outputs. It floods this thread with mostly unuseful text. Thanks.

@samueljohn
Copy link
Contributor

To all: The work-around is to brew edit pango and add the following line right after def install:

ENV.prepend 'PKG_CONFIG_PATH', "#{HOMEBREW_PREFIX}/lib/pkgconfig", ':'

@h-h we seek for a proper fix, which would involve to set the PKG_CONFIG_PATH with homebrew's own stuff in front, so this work-around would not be needed. If @github would have a kind of auto-collapse feature when pasting long things into fenced code blocks, all would be nice. But right now, a lot of people will potentially read through it without any benefit (for them) because they look for the fix not for yet another "look! I have the same error log as the original poster".
I did not meant to be unfriendly. I hope you can understand that and perhaps even remove, shorten or gist.github.com the log.

@ozataman
Copy link

@samueljohn Thanks for the workaround, did it for me as well!

@Frizlab
Copy link
Contributor

Frizlab commented Aug 25, 2012

Same here. The workaround worked :)

@2bits
Copy link
Contributor

2bits commented Aug 25, 2012

Clearly @samueljohn has found something and fixed it. So in addition to what he specifically fixed but without experimenting myself I need to say something. Within the last two weeks many changes have been made to Homebrew concerning cairo, fontforge, freetype2, libpng, and X11. Some changes were made the day after the OP posted. Everyone who experiences problems with any of those should seriously consider updating, removing their brews, and starting over because of how the formula have changed without changing versions (when that happens you are not told you have outdated formula). As an example of what I mean, we no longer require XQuartz for many formula. We instead will install freetype or libpng or cairo if you don't have X11. Those are new formula to the main repo within the last week or two. They are being adjusted as necessary (cairo just got a glib dep last night iirc). This is what I did after backing up my data:

brew rm -f `brew list`
brew update
brew prune
brew cleanup
brew doctor
brew install pkg-config cmake xz
brew install ...

@samueljohn
Copy link
Contributor

I should test removing all involved formulae and then I'll report back. I don't expect that will resolve the issue. The workaround has been discovered by the other people in this thread, I just posted the exact line of code :-)

I must stress that this is not a good fix in the long run. For sure @jacknagel knows how to fix properly :-)

Further I am in the process of making a pull request to highlight formulae that are currently installed and need to be upgraded (based on changed version numbers) when one brew updates.

@jacknagel
Copy link
Contributor

The problem here is that our cairo has an :x11 dep that is enabled by default, and because pango depends cairo the xquartz path gets prepended to PKG_CONFIG_PATH, but xquartz has it's own cairo and so that ends up first in the path.

This wasn't a problem before because cairo was keg-only, and keg-only paths are prepended to PKG_CONFIG_PATH after the xquartz path.

@jacknagel
Copy link
Contributor

By disabling quartz in cairo and restoring "--with-x" to pango I can overcome these problems, and build gtk+.

I suggest we restore pango's :x11 dep and "--with-x" flag for the time being. When my work on passing options to dependencies lands, we can remove it again and add a "with-x" option, and then gtk+ can do depends_on 'pango' => 'with-x'.

@samueljohn
Copy link
Contributor

Sounds good. Might it be a good idea to always have homebrews pkgconfig dirs first in the PKG_CONFIG_PATH?

@jacknagel
Copy link
Contributor

No, that has the potential to break other stuff, and is just hacking around the real problems. PKG_CONFIG_PATH is about overriding the default search path, so we shouldn't abuse it in that way.

@samueljohn
Copy link
Contributor

Convinced.

@jacknagel
Copy link
Contributor

Can someone apply https://github.com/jacknagel/homebrew/compare/x and see if it improves the situation?

@2bits
Copy link
Contributor

2bits commented Aug 26, 2012

Can someone apply https://github.com/jacknagel/homebrew/compare/x and see if it improves the situation?

cd `brew --prefix`
git checkout -b testX
brew pull https://github.com/jacknagel/homebrew/commit/bbcff5ad01be4565a6bb480d97fb2f4581efbe5a
brew pull https://github.com/jacknagel/homebrew/commit/092c6d014b8cc05fc23d430e0f8383c9d2bfe8da
brew pull https://github.com/jacknagel/homebrew/commit/108808d7915d9f3efe1398d588ff9268d7e4b6a0
brew pull https://github.com/jacknagel/homebrew/commit/7da1c8839e8d99990c38f85e386cccf575513e78
brew install pango
/usr/local/Cellar/pango/1.30.1: 132 files, 4.0M, built in 25 seconds

Yes. It compiles well.

$ brew test -v pango
Testing pango
==> /usr/local/Cellar/pango/1.30.1/bin/pango-view -t test-image --waterfall --rotate=10 --annotate=1 --header -q -o output.png
/usr/local/Cellar/pango/1.30.1/bin/pango-view -t test-image --waterfall --rotate=10 --annotate=1 --header -q -o output.png
**
Pango:ERROR:pangocoretext.c:49:void pango_core_text_font_finalize(GObject *): assertion failed: (priv->fontmap != NULL)
Error: pango: failed

and no :-) but that test I wrote was getting hammered a month or so before XQuartz and HB-0.9.2. It started back when glib was changed to include gobject I think.

@2bits
Copy link
Contributor

2bits commented Aug 26, 2012

It seems pango-view doesn't like the -q option which tells it no-display. If I remove that, it works, even without qlmanage. So the test can be reduced to:

  def test
    mktemp do
      system "#{bin}/pango-view", "-t", "test-image",
                                  "--waterfall", "--rotate=10",
                                  "--annotate=1", "--header"
    end
  end

@jacknagel
Copy link
Contributor

Pushed my pango/gtk fixups; other than the test, are there any outstanding issues here?

@evanmeng
Copy link

With the fix, can get gtk and pango built. However, test gtk failed:

Macintosh:~ evanmeng$ brew test gtk
Testing gtk+
==> /usr/local/Cellar/gtk+/2.24.11/bin/gtk-demo

(process:45232): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.

(gtk-demo:45232): Gtk-WARNING **: cannot open display: 
Error: gtk+: failed

@evanmeng
Copy link

My fault, I didn't make XQuartz my default X11 environment after installing it.

after

launchctl load /Library/LaunchAgents/org.macosforge.xquartz.startx.plist

and restart, gtk works.

@2bits
Copy link
Contributor

2bits commented Aug 27, 2012

@evanmeng phew! That's good news.

@samueljohn
Copy link
Contributor

@2bits @jacknagel does the doctor detect, if XQuartz is not the default X11 environment? Should he?

@evanmeng
Copy link

@samueljohn

I think Apple's default X11 should also work. The problem I met may be caused by the fact I didn't set any X11 environment to be default and start with my system. In fact, if you manually start XQartz.app (or X11.app, I think) and run gtk-demo there, it will work.

@a-foutoyet
Copy link

With all those fixes I'm a bit lost (I'm a huge noob with homebrew)
Could you tell me how I could clean and re instal FontForge without error ?

@samueljohn
Copy link
Contributor

@a-foutoyet given you have installed XQuartz and Xcode and brew updated, make sure to go to the brew doctor and try to reinstall. I'd suggest here to remove all dependencies (brew deps fontforge).
Then brew install fontforge.

Please leave a note either if that works or not.

@samueljohn
Copy link
Contributor

@evanmeng Ya, perhaps it's okay but I would be curious what your brew doctor and/or brew --config looked when there was no X11. But I don't ask you to remove your X11 just for this test, rather leave it as is and "never touch a..... " :-)

@a-foutoyet
Copy link

@samueljohn thanks a lot for your feedback.

I've made a brew update, then brew doctor (told me to brew install freetype...)
After that I've tried "brew install fontforge" and I've got this error :

PATH: /usr/local/Cellar/libffi/3.0.11/bin:/usr/local/Cellar/gettext/0.18.1.1/bin:/opt/X11/bin:/opt/subversion/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/opt/subversion/bin/:/opt/X11/bin:/usr/local/Library/Contributions/cmds

Error: Failed executing: make (fontforge.rb:77)

bash-3.2$ brew doctor
Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
/opt/subversion/bin/ /opt/subversion/bin/

Do you know how I could edit the directories listed above in order to delete the last slash (Warning) ?

@2bits
Copy link
Contributor

2bits commented Aug 28, 2012

Your PATH is usually set in one of these files that are in your home directory (you might not have all of them):

.profile
.bash_profile

usually on a line that says something like

export PATH=/opt/subversion/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/opt/subversion/bin/:/opt/X11/bin

But you want it to be more like this:

export PATH=/opt/subversion/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

Once you have edited the file (on my system it is ~/.bash_profile) and saved the file, open a new terminal tab by clicking on Terminal and pressing ⌘-t Then you should be in good order. Homebrew normally runs the best when people put /usr/local/bin before /usr/bin. That is why I changed that.

@samueljohn
Copy link
Contributor

@bits is our 🚑 here! Perfect description.
I guess @mxcl is right, even if we think it's clear, the doctor really should suggest more 💊s than only technical diagnoses :-D

@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
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