Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cairo won't install on clean v0.6 system (macOS High Sierra, Julia v0.6.4) #230

Closed
cormullion opened this issue Jul 21, 2018 · 35 comments · Fixed by #292
Closed

Cairo won't install on clean v0.6 system (macOS High Sierra, Julia v0.6.4) #230

cormullion opened this issue Jul 21, 2018 · 35 comments · Fixed by #292

Comments

@cormullion
Copy link
Member

I tried to install Cairo, on a new installation. It fails with a pangocairo error.

===============================================================[ ERROR: Cairo ]===============================================================

LoadError: Provider Homebrew.HB failed to satisfy dependency pangocairo
while loading /Users/me/.julia/v0.6/Cairo/deps/build.jl, in expression starting on line 161

==============================================================================================================================================

===============================================================[ BUILD ERRORS ]===============================================================

WARNING: Cairo had build errors.

 - packages with build errors remain installed in /Users/me/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("Cairo")`
 - build a single package by running its `deps/build.jl` script

==============================================================================================================================================
INFO: Package database updated

julia-0.6> 

Some pangocairo libraries were installed:

 ~/.julia/v0.6/Homebrew/deps/usr/lib  $ ls *pan*
libpango-1.0.0.dylib		libpangocairo-1.0.0.dylib	libpangoft2-1.0.0.dylib
libpango-1.0.a			libpangocairo-1.0.a		libpangoft2-1.0.a
libpango-1.0.dylib		libpangocairo-1.0.dylib		libpangoft2-1.0.dylib
@lobingera
Copy link
Contributor

Might be a BinDeps (in 0.6.4) or a Homebrew problem; i've seen similar - not finding the library - also on linux. This is really hard to reproduce and debug. My (local) workaround is: take care that libraries are installed and write deps.jl manually.

@cormullion
Copy link
Member Author

So it might be possible to borrow a deps.jl file from somewhere and put it into Cairo/deps/, and point it to the libraries it needs? OK, I'll have a go at that this week.

@CiaranOMara
Copy link

I have the same issue.

@matthieugomez
Copy link

Same issue.

@lobingera
Copy link
Contributor

i see this reproduced in https://travis-ci.org/JuliaGraphics/Cairo.jl/jobs/401860559

@cormullion
Copy link
Member Author

I'm a bit puzzled why this started recently, I thought Julia v0.6 was stable, and v0.7 was where all the instability was. Cairo seems to install happily on version v0.7, and I'm even able to use the v0.7 Cairo bindeps.jl with v0.6.

@fipelle
Copy link

fipelle commented Jul 24, 2018

Same problem on a clean v0.6.4. (also Rsvg.jl)

@cormullion
Copy link
Member Author

cormullion commented Jul 25, 2018

Travis is now reporting the same error for v0.7 beta on macOS. So no Cairo with Julia on the Mac anymore? (unless you try Julia v0.5...) :)

@lobingera
Copy link
Contributor

As said above, this seems to be an interaction between BinDeps and Homebrew. I'm currently trying to get some further testing running to see, what is actually happening. I asked yesterday on slack, but didn't get any reply if there is 'other' cases.

@cormullion
Copy link
Member Author

Yes I feel bad about reporting it here because I don't think there's a problem with Cairo.jl ... :)

@lobingera
Copy link
Contributor

@cormullion you could report on JuliaPackaging/BinDeps.jl#366

@cormullion
Copy link
Member Author

tbh I didn't really know about BinDeps until you started linking it.

@NHDaly
Copy link

NHDaly commented Jul 26, 2018

So for whatever reason, it looks like the problem is that libpangocairo-1.0.dylib won't actually dlopen succesfully:

julia0.6> h = Libdl.dlopen_e("/Users/daly/.julia/v0.6/Homebrew/deps/usr/lib/libpangocairo-1.0.dylib", Libdl.RTLD_LAZY)
>> Ptr{Void} @0x0000000000000000

EDIT: I tried opening all the other libraries first (libpng, pixman, libffi, gettext, gobject, fontconfig, fontconfig, cairo, and pango)
I tried opening cairo, pango, gobject, fontconfig, and freetype first (which all opened fine), but it didn't help. I also saw on PangoCairo's website that it also depends on PangoFT2, but I can't get that to open successfully either.

So I think that's why it's being skipped here:
https://github.com/JuliaPackaging/BinDeps.jl/blob/master/src/dependencies.jl#L675
causing the whole group to fail.

@cormullion
Copy link
Member Author

@NHDaly Perhaps a corrupt file? Wrong library? Try comparing it with the one that gets downloaded with version 0.7... (however one does that...)

@NHDaly
Copy link

NHDaly commented Jul 28, 2018

Hmm, no it's exactly the same on v0.7. Same version of the library, and same behavior. For me, both versions of julia installed [...]/Homebrew/[...]/deps/usr/Cellar/pango/1.42.2_1/lib/libpangocairo-1.0.0.dylib, and in both julias, attempting to open it returns null. :/

@NHDaly
Copy link

NHDaly commented Jul 28, 2018

Aha! Running Libdl.open, instead of Libdl.open_e, actually outputs an error message! (Presumably, open_e means "open and allow errors".) Good to know!

Okay:

ERROR: could not load library "/Users/daly/.julia/packages/Homebrew/IgU0/deps/usr/Cellar/pango/1.42.2_1/lib/libpangocairo-1.0.0.dylib"
dlopen(/Users/daly/.julia/packages/Homebrew/IgU0/deps/usr/Cellar/pango/1.42.2_1/lib/libpangocairo-1.0.0.dylib, 1): Library not loaded: /Users/daly/.julia/packages/Homebrew/IgU0/deps/usr/opt/fontconfig/lib/libfontconfig.1.dylib
  Referenced from: /Users/daly/.julia/packages/Homebrew/IgU0/deps/usr/Cellar/pango/1.42.2_1/lib/libpangocairo-1.0.0.dylib
  Reason: Incompatible library version: libpangocairo-1.0.0.dylib requires version 13.0.0 or later, but libfontconfig.1.dylib provides version 12.0.0

SO the problem is conflicting versions of libfontconfig! :) Someone must be forcing us to keep version 12.


And actually, come to think of it, I've noticed there's something wrong with fontconfig as well. Whenever Pkg tries to rebuild Homebrew (which it seems like almost every Pkg command ends up doing...), it keeps uninstalling and reinstalling fontconfig for some reason:

(21:59:43) julia0.6> Pkg.build("Homebrew")
INFO: Building Homebrew
Already up-to-date.
Warning: Calling 'depends_on :perl' is deprecated!
Use 'depends_on "perl"' instead.
/Users/daly/.julia/v0.6/Homebrew/deps/usr/Library/Taps/staticfloat/homebrew-juliadeps/[email protected]:58:in `<class:ImagemagickAT6>'
Please report this to the staticfloat/juliadeps tap!

Warning: Calling 'depends_on :perl' is deprecated!
Use 'depends_on "perl"' instead.
/Users/daly/.julia/v0.6/Homebrew/deps/usr/Library/Taps/staticfloat/homebrew-juliadeps/[email protected]:58:in `<class:ImagemagickAT6>'
Please report this to the staticfloat/juliadeps tap!

Uninstalling fontconfig... (493 files, 3.2MB)
Warning: Calling 'depends_on :perl' is deprecated!
Use 'depends_on "perl"' instead.
/Users/daly/.julia/v0.6/Homebrew/deps/usr/Library/Taps/staticfloat/homebrew-juliadeps/[email protected]:58:in `<class:ImagemagickAT6>'
Please report this to the staticfloat/juliadeps tap!

==> Installing fontconfig from staticfloat/juliatranslated
==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.12.6.high_sier
Already downloaded: /Users/daly/Library/Caches/Homebrew.jl/fontconfig-2.12.6.high_sierra.bottle.tar.gz
==> Pouring fontconfig-2.12.6.high_sierra.bottle.tar.gz
==> Regenerating font cache, this may take a while
==> /Users/daly/.julia/v0.6/Homebrew/deps/usr/Cellar/fontconfig/2.12.6/bin/fc-ca
🍺  /Users/daly/.julia/v0.6/Homebrew/deps/usr/Cellar/fontconfig/2.12.6: 493 files, 3.2MB
Warning: Already linked: /Users/daly/.julia/v0.6/Homebrew/deps/usr/Cellar/fontconfig/2.12.6

(22:02:27) julia0.6>

And yeah, that's definitely version 12... I wonder why!

@NHDaly
Copy link

NHDaly commented Jul 28, 2018

Huh, so based on this other random thread where people were also having (I think) unrelated problems with fontconfig in Homebrew.jl, I ran this, and it fixed everything:

using Homebrew
Homebrew.brew(`reinstall fontconfig`)
Pkg.build("Cairo")

Reinstalling fontconfig installs the correct version. But I have no idea why it was installing the wrong version in the first place!
After this workaround, Cairo is working on my computer. ✅

Would be great to figure out the root of the bug!

@cormullion
Copy link
Member Author

good sleuthing, Sherlock! :)

@NHDaly
Copy link

NHDaly commented Aug 14, 2018

OKAY good news, I think i've found the source of the problem. I was wondering, why is Homebrew installing version 2.12.6. So to figure it out, I renamed my ~/.julia/v0.6 directory to a clean-install, and re-installed Cairo. In the output, I see this:

==> Installing fontconfig from staticfloat/juliatranslated
==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.12.6.high_sier
Already downloaded: /Users/daly/Library/Caches/Homebrew.jl/fontconfig-2.12.6.high_sierra.bottle.tar.gz
==> Pouring fontconfig-2.12.6.high_sierra.bottle.tar.gz
==> Regenerating font cache, this may take a while
==> /Users/daly/.julia/v0.6/Homebrew/deps/usr/Cellar/fontconfig/2.12.6/bin/fc-ca
🍺  /Users/daly/.julia/v0.6/Homebrew/deps/usr/Cellar/fontconfig/2.12.6: 493 files, 3.2MB
Warning: Already linked: /Users/daly/.julia/v0.6/Homebrew/deps/usr/Cellar/fontconfig/2.12.6

I did some googling, and i finally found that staticfloat/juliatranslated comes from here:
https://github.com/JuliaPackaging/Homebrew.jl/blob/363c9bb82b21be8b9c9128d39d878c474f1c3076/test/runtests.jl#L106

And so i've filed staticfloat/homebrew-juliadeps#131 to try to get that fixed! 😊
It's hard for me to tell how these all work together, so i don't really know how to test it, but hopefully Elliot will be able to help us out from here. :)

@cormullion
Copy link
Member Author

Great! i wonder if you'll be needed for v1.0 ... :)

@NHDaly
Copy link

NHDaly commented Aug 14, 2018

😛 I'm happy to help if i can.. To be honest, i'm not even using Cairo, it's just a dep of a dep of a dep of mine... -_- haha

@NHDaly
Copy link

NHDaly commented Aug 14, 2018

Okay, this seems to be fixed after merging staticfloat/homebrew-juliadeps#131! :)

@affans
Copy link

affans commented Aug 22, 2018

I am having a lot of problems with Cairo in 0.7/1.0. I tried following the above instructions but I get the following (i deleted non-relevant lines from below). Any suggestions?

Here is some debug information

(v0.7) pkg> build Cairo
  Building LibCURL ─→ `~/.julia/packages/LibCURL/Qs5og/deps/build.log`
  Building WinRPM ──→ `~/.julia/packages/WinRPM/rDDZz/deps/build.log`
  Building Homebrew → `~/.julia/packages/Homebrew/l8kUw/deps/build.log`
  Building Cairo ───→ `~/.julia/packages/Cairo/blE1h/deps/build.log`
┌ Error: Error building `Cairo`:
│ ERROR: LoadError: Provider Homebrew.HB failed to satisfy dependency pangocairo

Thought maybe fontconfig was at 2.12 like above mentioned.. this dosn't seem to be the case

julia> Homebrew.brew(`reinstall fontconfig`)
...
==> Installing fontconfig
==> Downloading https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.0.tar.bz2
Already downloaded: /Users/abmlab/Library/Caches/Homebrew.jl/fontconfig-2.13.0.tar.bz2
==> ./configure --disable-silent-rules --enable-static --with-add-fonts=/System/Library/Fonts,/Library/Fonts,~/Library/F
==> make install RUN_FC_CACHE_TEST=false
==> Not running post_install as we're building a bottle
You can run it manually using `brew postinstall fontconfig`
Error: Cannot link fontconfig
Another version is already linked: /Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usr/Cellar/fontconfig/2.13.0
ERROR: failed process: Process(`/Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usrbin/brew reinstall fontconfig`, ProcessExited(1)) [1]

This tells me fontconfig is at 2.13. Infact in .julia/packages/Homebrew/l8kUw/deps/usr/Cellar/fontconfig I see the folder 2.13.

Trying to "open" the `pangocairo` library as suggested above gives the following error
ERROR: could not load library "/Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usr/lib/libpangocairo-1.0.0.dylib"
dlopen(/Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usr/lib/libpangocairo-1.0.0.dylib, 1): Library not loaded: /Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usr/opt/graphite2/lib/libgraphite2.3.dylib
  Referenced from: /Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usr/opt/harfbuzz/lib/libharfbuzz.0.dylib
  Reason: image not found

I am not sure what image not found is referring to. Does it mean the directory/file dosn't exist? This is certainly not the case. I have the libpangocairo-1.0.0.dylib at the right location

UPDATE success!

From the error above Library not loaded: /Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usr/opt/graphite2/lib/libgraphite2.3.dylib it seems that Homebrew was not installing graphite2

so I did

shell> brew install graphite2
==> Downloading https://homebrew.bintray.com/bottles/g
###########                                           ######################################################################## 100.0%
==> Pouring graphite2-1.3.12.high_sierra.bottle.tar.gz
🍺  /Users/abmlab/.julia/packages/Homebrew/l8kUw/deps/usr/Cellar/graphite2/1.3.12: 18 files, 236KB

and everything works.

@cormullion Maybe edit the title to have Julia 0.7/1.0 reference also. It seems that I was getting the same error on the newer versions.

@cormullion
Copy link
Member Author

@affans well there's another issue for 0.7... :)

@NHDaly
Copy link

NHDaly commented Aug 22, 2018

Good find, @affans! :D

@timholy
Copy link
Member

timholy commented Sep 2, 2018

Note to mac users: while manual installation of graphite2 might get things working for any individual who uses it, Cairo will continue to be broken "by default" for most mac users. We need your help figuring out the right way to fix this that will work for everyone. None of the core developers of Cairo.jl has a mac, so we'll rely on one of you kind and talented souls to get this done!

@NHDaly
Copy link

NHDaly commented Sep 2, 2018

So i'm not sure if this is helpful, but there is an option in the harfbuzz homebrew formula to build without graphite2?:

--without-graphite2
        Build without graphite2 support

@NHDaly
Copy link

NHDaly commented Sep 2, 2018

These is what i got from brew info:

$ brew info harfbuzz
harfbuzz: stable 1.8.8 (bottled), HEAD
OpenType text shaping engine
https://wiki.freedesktop.org/www/Software/HarfBuzz/
/usr/local/Cellar/harfbuzz/1.7.5 (139 files, 5.4MB)
  Poured from bottle on 2018-03-05 at 17:12:36
/usr/local/Cellar/harfbuzz/1.7.6_2 (150 files, 6.0MB)
  Poured from bottle on 2018-04-13 at 22:26:04
/usr/local/Cellar/harfbuzz/1.8.1 (151 files, 6.1MB) *
  Poured from bottle on 2018-06-13 at 19:04:21
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/harfbuzz.rb
==> Dependencies
Build: pkg-config ✔, gobject-introspection ✔
Required: cairo ✔, glib ✘
Recommended: freetype ✔, graphite2 ✘, icu4c ✔
==> Options
--without-freetype
        Build without freetype support
--without-graphite2
        Build without graphite2 support
--without-icu4c
        Build without icu4c support
--HEAD
        Install HEAD version

What else do you need for help?

@cormullion
Copy link
Member Author

Is this issue just for Julia v0.6?

@lobingera
Copy link
Contributor

No, it would be across all versions. However, i've just seen both travis triggered by @timholy 's PR build sucessfully and i did some travis magic to get to a debug build (so you can connect into the VM via ssh) and saw Cairo install and test successfully while it doesn't on 0.7/1.0. I have the feeling something is changing in the homebrew/Homebrew environment also.

@tkelman
Copy link
Contributor

tkelman commented Sep 2, 2018

What version of harfbuzz is Homebrew.jl trying to install here? If you're able to have a harfbuzz (and hence cairo) bottle installed from conventional brew without needing graphite2, then how is conventional brew installing something different from what Homebrew.jl is trying to install?

@lobingera
Copy link
Contributor

Actually i'm a little on the run right now, i'll return to the computer in a few hours.

@lobingera
Copy link
Contributor

I copypasted from the terminal two parts, brew install and Pkg.add/test in julia.
https://gist.github.com/lobingera/bf13da8edbaf785cc5b9d38a5f2d9b46

@tkelman
Copy link
Contributor

tkelman commented Sep 3, 2018

would need to diff the logs. is the behavior substantially different between 0.6 and 0.7?

@lobingera
Copy link
Contributor

Afaics you can run only 1 debug build in travis at a time, so this would need to be done sequentially. But it might be we are following a moving target anyway, pango 1.42.something was release a few days ago, so some packages on the line can show up updated. I'll look into this later this week.

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

Successfully merging a pull request may close this issue.

9 participants