2007/11/14

Compile/Run icc with cairo

Hi all,

I've tried icc 10.1 Pro with cairo ( http://cairographics.org/releases/cairo-1.4.10.tar.gz )

the installation went smooth as follows:

CentOS 5.
[vuhung@aoclife cairo]$ uname -r
2.6.18-8.el5
[vuhung@aoclife cairo]$ rpm -qa | grep glibc
glibc-2.5-12
glibc-headers-2.5-12
glibc-common-2.5-12
glibc-devel-2.5-12
[vuhung@aoclife cairo]$

yum install libstdc++.so.5
tar xvzf l_cc_p_10.1.008.tar.gz
cd l_cc_p_10.1.008
./install
#serial number: VJFV-MP9H3R5J
cat "source /opt/intel/cc/10.1.008/bin/iccvars.sh" >> ~/.bash_profile

icc now can run.

Then,

cd ~/usr/src/cairo-1.4.10
./configure --without-xlib --disable-xlib CC=icc
make;
make install

And when I tried to compile icc with cairo ( hello.c ):

icc -o hello `pkg-config --cflags --libs cairo` hello.c

I got the error:

icc -o hello `pkg-config --cflags --libs cairo` hello.c
/tmp/icck8ycA8.o: In function `main':
hello.c:(.text+0x1c): undefined reference to `cairo_image_surface_create'
hello.c:(.text+0x24): undefined reference to `cairo_create'
hello.c:(.text+0x80): undefined reference to `cairo_move_to'
hello.c:(.text+0x91): undefined reference to `cairo_destroy'
hello.c:(.text+0xa2): undefined reference to `cairo_surface_destroy'

where:

[vuhung@aoclife cairo]$ pkg-config --cflags --libs cairo
-I/usr/local/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -L/usr/local/lib -lcairo

Yes, icc couldn't find some API. Because I am new to icc, I don't know how icc creates and links the libraries.

If in the steps above, I replace icc with gcc, everything will be fine.



-----------cut here ------------
#include

int
main (int argc, char *argv[])
{
cairo_surface_t *surface;
cairo_t *cr;

surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80);
cr = cairo_create (surface);

cairo_select_font_face (cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 32.0);
cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
cairo_move_to (cr, 10.0, 50.0);
cairo_show_text (cr, "Hello, world");
cairo_destroy (cr);
cairo_surface_write_to_png (surface, "hello.png");
cairo_surface_destroy (surface);

return 0;
}

--------------------------------


0 件のコメント: