LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2010, 11:32 AM   #1
tank junior
Member
 
Registered: Apr 2010
Posts: 42

Rep: Reputation: 0
Compile Cairo/PyCairo from sources on ubuntu hardy


Hi,

I am trying to compile latest pixman/cairo/pycairo from sources on ubuntu hardy LTS 8.04. The default versions are pretty older. These are the versions of three packages I am using:

1. pixman-0.18.0
2. cairo-1.8.10
3. pycairo-1.8.8

Please note that I am new to linux with limited skills in c/c++ stuff.

First you have to compile pixman and here is the script I am using:
Code:
$wget http://www.cairographics.org/releases/pixman-0.18.0.tar.gz
$tar xvf pixman-0.18.0.tar.gz
$cd pixman-0.18.0
$./configure --prefix=/usr/local
$make
$sudo make install
While configuring it configures everything fine except in the end when an example of pixman throws an error:
Code:
clip-test.o: In function `main':
/home/prashant/installed/pixman-0.18.0/test/clip-test.c:73: undefined reference to `pixman_region32_init_rect'
/home/prashant/installed/pixman-0.18.0/test/clip-test.c:74: undefined reference to `pixman_image_set_clip_region32'
collect2: ld returned 1 exit status
Now I have no idea whether pixman version is broken or anything else. I am out of luck in cairo mailing list.
How ever if I move forward, the pixman libraries are installed in /usr/local/

It seems because pixman configuration has ended in between, I am not getting pkgconfig directory in /usr/local/lib/pkgconfig. To compile cairo, it's required to set PKG_CONFIG_PATH.
Code:
# create PKG_CONFIG_PATH env var to point out "pixman-1.pc" path. In
my case this is directory where
# I untar the contents of pixman-0.18.0.tar.gz.
export PKG_CONFIG_PATH=/home/<user>/installed/pixman-0.18.0
Next is to build cairo from source and here is the script:
Code:
$wget http://www.cairographics.org/releases/cairo-1.8.10.tar.gz
$tar xvf cairo-1.8.10.tar.gz
$cd cairo-1.8.10
$pixman_LIBS="/usr/local/lib" CPPFLAGS="-I/usr/local/include/pixman-1"
LDFLAGS="-L/usr/local/lib" ./configure --prefix=/usr/local
$make
$make install
This produces cairo libraries in /usr/local but I am little doubtful about the flags, I have used with ./configure. The idea is to compile cairo against pixman that you have just built or I think it'll be compiled against the older one installed on your system.

Now I have a directory in /usr/local/lib/pkgconfig with all the cairo files in it. I have to append the PKG_CONFIG_PATH var
Code:
# Extend PKG_CONFIG_PATH & create LD_LIBRARY_PATH
$export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
$export LD_LIBRARY_PATH=/usr/local/lib
Finally compile pycairo:
Code:
# build pycairo from sources
$wget http://www.cairographics.org/releases/pycairo-1.8.8.tar.gz
$tar xvf pycairo-1.8.8.tar.gz
$cd pycairo-1.8.8
$./configure
$make
$make install
pycairo library is correctly getting installed in site_packages directory. How ever when I "import cairo", I am getting this error:
Code:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/site-packages/cairo/__init__.py", line 1, in <module>
    from _cairo import *
ImportError: /usr/local/lib/libcairo.so.2: undefined symbol: pixman_region32_rectangles
I cleaned up every thing and followed the entire steps again but same pixman error. However this time when I "import cairo" the error is different:
Code:
>>> import cairo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/site-packages/cairo/__init__.py", line 1, in <module>
    from _cairo import *
ImportError: /usr/local/lib/python2.6/site-packages/cairo/_cairo.so: undefined symbol: cairo_pattern_get_type
This time a different symbol is missing. I would really appreciate if some point me out the right direction. Having this problem solved will also give me an idea to understand the compiling/building stuff on linux, which you certainly can't omit if you want to continue on Linux.

Cheers

Prashant

Last edited by tank junior; 04-25-2010 at 11:35 AM.
 
Old 04-25-2010, 12:58 PM   #2
Andrew Benton
Senior Member
 
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
My guess is that, if you're getting 'undefined symbols' error messages, you're getting a conflict between the things you've installed in /usr/local/lib and the older libraries in /usr/lib. Is LD_LIBRARY_PATH still set when you get these errors?
Code:
echo $LD_LIBRARY_PATH
 
Old 04-25-2010, 01:35 PM   #3
tank junior
Member
 
Registered: Apr 2010
Posts: 42

Original Poster
Rep: Reputation: 0
Yes, LD_LIBRARY_PATH is set to /usr/local/lib/. This stuff is getting into my nerves.
 
Old 03-26-2012, 05:15 AM   #4
liorkirsch
LQ Newbie
 
Registered: Mar 2012
Posts: 1

Rep: Reputation: Disabled
I am having the same error:
undefined symbol: cairo_pattern_get_type python

did you manage to resolve this ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED]Cairo-dock plugins compile error Scott271 Slackware 7 02-21-2010 08:25 AM
Compile and runtime errors with Cairo Dock on KDE 4 ESC201 Linux - Software 1 11-26-2008 03:20 PM
LXer: How-To: Compile and Install SMPlayer 0.6.2 in Ubuntu 8.04 'Hardy Heron' LXer Syndicated Linux News 0 09-13-2008 02:50 AM
LXer: HowTo Compile rTorrent From SVN In Ubuntu 8.04 Hardy Heron LXer Syndicated Linux News 0 05-21-2008 03:20 PM
gcc in ubuntu faile to compile some sources raduromeo Linux - Software 7 08-20-2006 10:14 AM


All times are GMT -5. The time now is 04:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration