How to install Cairo 1.8.10
If you want to test out an old version of Cairo, you can build it in a temporary prefix in your home directory.
First of all, make sure you've got Cairo's build dependencies installed. You can do this with the following command:
sudo apt-get build-dep cairo
Now download and unpack the old version of Cairo:
wget http://cairographics.org/releases/cairo-1.8.10.tar.gz
tar xzf cairo-1.8.10.tar.gz
cd cairo-1.8.10
Now you want to build Cairo into a temporary prefix. I've used ~/prefix
for this on a few occasions, but you can use any directory.
./configure --prefix=$HOME/prefix
make
make install
Now you need to make your own software use this version of Cairo. If the software uses pkg-config
to locate its dependencies, it should only be necessary to set the following environment variable:
export PKG_CONFIG_PATH=$HOME/prefix/lib/pkgconfig
If it isn't using pkg-config
, you might need to adjust CFLAGS
to include -I$HOME/prefix/include
and LDFLAGS
to include -L$HOME/prefix/lib
.
Finally, to run your program using the custom version of Cairo you will need to configure the dynamic linker so it looks for shared libraries in your temporary prefix:
export LD_LIBRARY_PATH=$HOME/prefix/lib
Once that is set, you can verify that your program is linking against your copy of Cairo using ldd
. If that looks okay, you're all done.
Cleaning Up
Once you're done with this temporary install, cleaning up is pretty easy. Just reset the environment variables and remove the temporary install prefix:
unset LD_LIBRARY_PATH
unset PKG_CONFIG_PATH
rm -rf $HOME/prefix
You may need to reconfigure/rebuild your program after doing this to make it use the system Cairo again.
Related videos on Youtube
Daniel Standage
Husband, father, scholar, scientist, programmer, lapsed musician, flipper of pancakes, baker of biscuits.
Updated on September 18, 2022Comments
-
Daniel Standage almost 2 years
The package
libcairo2-dev
is the latest version of the Cairo graphics library (1.10.2). Is there any way I can install version 1.8.10?I'm running 11.10, but would be interested in a general solution if possible.
-
James Henstridge over 12 yearsCould you explain why you want to install the older version? Installing the older version system wide is probably not a possibility (some programs may depend on features of the newer release), but if you have a narrower requirement for the older version then a solution might be possible.
-
Daniel Standage over 12 yearsI personally know very little about Cairo, but I have written a program that links to a library that in turn uses Cairo to generate graphics. I did most of the original development on my Mac, for which Cairo installation was only available through something like Fink (which only has v1.8.10)...
-
Daniel Standage over 12 years...The program also uses OpenMP, and one of the parallelized for loops includes calls to the Cairo library functions. The program works on Ubuntu when I run it on a single processor, and it works on Mac for any number of processors. But when I run it on Ubuntu with multiple processors, I get aborts, segfaults, glibcs, etc.
-
Daniel Standage over 12 yearsI understand that downgrading to v1.8.10 isn't something you would want for a long term solution, and if you could isolate the installation it may even be better. I have already distributed the software and I simply want to have a temporary stop-gap until I can figure out what's really wrong with my program.
-
James Henstridge over 12 yearsFor reference, the version numbers for Cairo go 1.8 -> 1.9 -> 1.10, so the version included with Ubuntu should be able to do everything the version you used on MacOS did. If you're only accessing Cairo through a third party library you aren't modifying, you shouldn't have to worry about accidentally using new features and breaking compatibility with your old development environment either. If you have run into a problem with the new version, could you explain what it is?
-
-
Daniel Standage over 12 yearsExcellent and clear instructions, with a clean install and uninstall process. Thanks!
-
Dau almost 6 yearsHow to remove default include paths from $HOME so that it will not use default cairo files