Andrew Cooke | Contents | Latest | RSS | Previous | Next

C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

Personal Projects

Choochoo Training Diary

Last 100 entries

© 2006-2017 Andrew Cooke (site) / post authors (content).

Julia's BinDeps (aka How To Install Cairo)

From: andrew cooke <andrew@...>

Date: Thu, 27 Aug 2015 19:53:03 -0300

I just wasted a few painful hours trying to install the Julia Cairo package.
Hopefully the following will help others avoid the frustration.


The Cairo package https://github.com/JuliaLang/Cairo.jl uses BinDeps
https://github.com/JuliaLang/BinDeps.jl - an easy way to see this is to note
that the Cairo package contains a deps directory, which itself contains a
build.jl file https://github.com/JuliaLang/Cairo.jl/blob/master/deps/build.jl

That build.jl file is the spec that BinDeps uses to decide whether (and how)
it should build Cairo from source.

Building Cairo from source currently fails.  So we don't want to build Cairo
from source.  Unfortunately, Pkg.add("Cairo") did try to do so.

So the question is - WHY DOESN'T IT USE THE CAIRO LIBRARY I HAVE ALREADY
INSTALLED ON MY MACHINE?  And here is the answer.


If you look at the buuld.jl file linked above you'll see a neat, declarative
section inside an array called "deps" that specifies what libraries are
required.

The frustrating thing is, as far as I can tell, ALL LIBRARIES MUST BE PRESENT.
If only one is missing, then EVERYTING is built from source.

Sorry for the CAPS but I AM FEELING KINDA SHOUTY RIGHT NOW.

So, if you're wondering why a package is being built from source, a simple way
to find out is to fire up julia:

  andrew@...:~/.julia/v0.4/Cairo> julia-trunk 
		 _
     _       _ _(_)_     |  A fresh approach to technical computing
    (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
     _ _   _| |_  __ _   |  Type "help()" for help.
    | | | | | | |/ _` |  |
    | | |_| | | | (_| |  |  Version 0.4.0-dev+6774 (2015-08-17 10:35 UTC)
   _/ |\__'_|_|_|\__'_|  |  Commit f3217a8 (10 days old master)
  |__/                   |  x86_64-suse-linux

and load BinDeps

  julia> using BinDeps

and start BinDeps

  julia> @BinDeps.setup()
  library_dependency (generic function with 1 method)

and try testing different libraries.  Just cut+paste the initial part of each
description (ignoring the keyword arguments).

This kind of thing is OK:

  julia> pango = library_dependency("pango", aliases = ["libpango-1.0-0",
  "libpango-1.0","libpango-1.0.so.0", "libpango-1_0-0"])
   - Library "pango"
      - Satisfied by:
	- System Paths at /usr/lib64/libpango-1.0.so

But this kind of thing is NOT:

  julia> library_dependency("gettext", aliases = ["libintl", "preloadable_l
	 ibintl", "libgettextpo"])
   - Library "gettext"

When you get soemthing without a "Satisfied by" then you need to run to your
package manager and install it, toot sweet.

Note that (unless you are on Windows ha ha) you don't need to check a spec
that looks like 

  zlib = library_dependency("zlib", aliases = ["libzlib","zlib1"], 
                            os = :Windows, group = group)

because the "os = :Windows" means it's only required there.

And if you do all that, then clean things up:

  julia> Pkg.rm("Cairo")
  
  $ rm -fr ~/.julia/v0.4/Cairo

  julia> Pkg.add("Cairo")
  INFO: Installing Cairo v0.2.29
  INFO: Building Cairo
  INFO: Package database updated

everything works :o)

Andrew

An Easier Way

From: andrew cooke <andrew@...>

Date: Thu, 27 Aug 2015 20:04:57 -0300

As described https://github.com/JuliaLang/BinDeps.jl/issues/164 (cryptically)
you can also do the following:

  julia> using BinDeps

  julia> BinDeps.debug("Cairo")
  INFO: Reading build script...
  The package declares 1 dependencies.
   - Library Group "cairo" (satisfied by BinDeps.SystemPaths,
   BinDeps.SystemPaths)
       - Library "png" (not applicable to this system)
       - Library "pixman" (not applicable to this system)
       - Library "ffi" (not applicable to this system)
       - Library "gettext"
	  - Satisfied by:
	    - System Paths at /usr/lib64/preloadable_libintl.so
	    - System Paths at /usr/lib64/libgettextpo.so
	  - Providers:
	    - BinDeps.AptGet package gettext (can't provide)
	    - BinDeps.Yum package gettext-libs (can't provide)
	    - Autotools Build
       - Library "gobject"
	  - Satisfied by:
	    - System Paths at /usr/lib64/libgobject-2.0.so
	  - Providers:
	    - BinDeps.AptGet package libglib2.0-0 (can't provide)
	    - BinDeps.Yum package glib2 (can't provide)
	    - Autotools Build
       - Library "freetype" (not applicable to this system)
       - Library "fontconfig" (not applicable to this system)
       - Library "cairo"
	  - Satisfied by:
	    - System Paths at /usr/lib64/libcairo.so
	  - Providers:
	    - BinDeps.AptGet package libcairo2 (can't provide)
	    - BinDeps.Yum package cairo (can't provide)
	    - Autotools Build
       - Library "pango"
	  - Satisfied by:
	    - System Paths at /usr/lib64/libpango-1.0.so
	  - Providers:
	    - BinDeps.AptGet package libpango1.0-0 (can't provide)
	    - BinDeps.Yum package pango (can't provide)
	    - Autotools Build
       - Library "pangocairo"
	  - Satisfied by:
	    - System Paths at /usr/lib64/libpangocairo-1.0.so
	  - Providers:
	    - BinDeps.AptGet package libpango1.0-0 (can't provide)
	    - BinDeps.Yum package pango (can't provide)
	    - Autotools Build
       - Library "zlib" (not applicable to this system)

Andrew

install cairo

From: Shadrack <sofori@...>

Date: Fri, 2 Aug 2019 12:03:56 -0500

how do i install it on the package manager? I don=E2=80=99t have the =
'satisfied by=E2=80=99. Using julia 1.1 on a MacOSX El Capitan=20=

Comment on this post