Skip to content

Installation on various platforms

stanislaw edited this page Oct 5, 2012 · 13 revisions

Installation on various platforms

Common for all systems

libvips

libvips relies on pkg-config, so it likes to be aware of every possible pkg-config path you have. Unfortunately, $PKG_CONFIG_PATH variable has almost never been seen to be set automatically on a bunch of Linux systems and Mac OS X. Workaround here is to add the following line into $/.bash_profile:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig

This hack works perfect, though any solutions from more sysadmin-skilled people would be appreciated.

If you have some alternative paths for pkg_config of libvips or its dependencies, the following commands are your friends:

pkg-config --list-all |grep -i vips
pkg-config --libs vips

Installing to a custom directory for experimental use (install/uninstall easily)

Install to a prefix in your home directory, like this:

./configure --prefix=/home/john/vips
make 
make install

Set these environment variables in your .bashrc:

export VIPSHOME=/home/john/vips
export PATH=$VIPSHOME/bin:$PATH
export LD_LIBRARY_PATH=$VIPSHOME/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$VIPSHOME/lib/pkgconfig:$PKG_CONFIG_PATH

Then if you ever want wipe it and try again:

rm -rf ~/vips

no uninstalling to do.

Mac OS X Lion

libvips - brew vs macports vs native OS X distributed packages.

The key problem when compiling the latest libvips on Mac OS X is that it very often doesn't pick up the right packages you need for build, especially native OS X packages. For example, libvips ./configure finishes with PNG support disabled and attempt to brew install libpng gives the following output:

$ brew install libpng
Error: No available formula for libpng
Apple distributes libpng with OS X, you can find it in /usr/X11/lib.
However not all build scripts look here, so you may need to call ENV.x11
in your formula's install function.

Possible solution for libpng in this case: download official libpng .dmg package, and then continue configuring vips with png support enabled.

Here is the list of packages which are known to cause problems:

  • libxml2 and freetype2
$ pkg-config --libs vips
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libxml-2.0', required by 'vips-7.30', not found

$ PKG_CONFIG_PATH=/usr/local/Library/Homebrew/pkgconfig pkg-config --libs vips
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'freetype2', required by 'Pango FT2 and Pango Fc', not found

$ PKG_CONFIG_PATH=/usr/local/Library/Homebrew/pkgconfig:/opt/X11/lib/pkgconfig pkg-config --libs vips
-L/opt/X11/lib -L/usr/local/Cellar/vips/7.30.0/lib -L/usr/local/Cellar/libtiff/4.0.2/lib -L/usr/local/Cellar/glib/2.32.4/lib -L/usr/local/Cellar/gettext/0.18.1.1/lib -L/usr/local/Cellar/pango/1.30.1/lib -L/usr/local/Cellar/fftw/3.3.2/lib -L/usr/local/Cellar/little-cms/1.19/lib -L/usr/local/Cellar/openexr/1.7.0/lib -L/usr/local/Cellar/ilmbase/1.0.2/lib -L/usr/local/Cellar/cfitsio/3.310/lib -L/usr/local/Cellar/libexif/0.6.21/lib -lvips -ljpeg -lstdc++ -lgmodule-2.0 -lxml2 -lgthread-2.0 -lfftw3 -lm -llcms -lIlmImf -lz -lImath -lHalf -lIex -lIlmThread -lcfitsio -lpangoft2-1.0 -ltiff -lpng15 -lexif -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lintl
  • libpng - can be resolved by installing libpng .dmg package from official site or by resolving proper $PKG_CONFIG_PATH.
  • gettext - libvips can somehow do not recognize gettext brew installation. So the following addition to libvips configuration may be needed:
LDFLAGS=-L/usr/local/Cellar/gettext/0.18.1.1/lib CPPFLAGS=-I/usr/local/Cellar/gettext/0.18.1.1/include ./configure
  • pangoft2 - freetype, fontconfig should be installed and recognized. /usr/X11/lib/pkgconfig should be included into $PKG_CONFIG_PATH see ('Common for all systems section').

  • Strange Segmentation fault [BUG], two similar reports on https://github.com/jcupitt/ruby-vips/issues/17 - disappeared after switching to brew (almost completely, ~10 macports core packages were left: like perl5, libtool, libffi, zlib).

History of resolving these or similar problems can be found among the closed issues on ruby-vips tracker: #24 and others.

CentOS 5.5

libvips

Note: The biggest problem of installing latest vips on CentOS5 is that it depends on glib2 of much higher versions than available in CentOS5 repo. Recently John added support for CentOS5 - he took off libvips dependency on higher versions of glib2 - now libvips can be installed without need to upgrade glib2, using just repo's 2.12.3 version.

If you are trying to compile <7.28.8 version, you additionally need to upgrade glib2 to this version - 2.21.6 - I couldn't manage to compile libvips using following glib versions: 2.16, 2.17, 2.32, I advice you version that worked for me (see compilation steps right below)

# For libvips < 7.28.8
wget http://ftp.acc.umu.se/pub/gnome/sources/glib/2.21/glib-2.21.6.tar.gz
tar zxvf glib-2.21.6.tar.gz
cd glib-2.21.6/
./configure
make
make install

And finally

wget -c http://www.vips.ecs.soton.ac.uk/supported/current/vips-7.28.8.tar.gz
tar xzvf vips-7.28.8.tar.gz
cd vips-7.28.8
./configure && make && make install

ruby-vips gem

gem install ruby-vips

Possible problems

Following EXPORT is needed if you will have problems like described here: https://github.com/jcupitt/libvips/issues/20

# https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=VIPSIP;db1e4401.0706
# To run 'gem install vips' once
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
# or for constant use
$ echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" >> ~/.bash_profile

If you will see:

1.9.3-p194 :001 > require 'vips'
LoadError: libvips.so.32: cannot open shared object file: No such file or directory

Do this:

$ echo "/usr/local/lib/" >> /etc/ld.so.conf.d/local.conf
$ /sbin/ldconfig

Gentoo

If you are trying to compile the latest vips source from official site, see "Possible problems" section from instructions for CentOS 5.5.

Clone this wiki locally