Re: Trouble with create_cairo_context



Mark Tilford wrote:
On Tue, Oct 7, 2008 at 10:24 AM, Jonathon Jongsma
<jonathon quotidian org> wrote:
Mark Tilford wrote:
On Sun, Sep 28, 2008 at 7:43 PM, Jonathon Jongsma
<jonathon quotidian org> wrote:
Mark Tilford wrote:
On Sat, Sep 27, 2008 at 1:55 PM, Mark Tilford <ralphmerridew gmail com>
wrote:
Anybody ever figure out what caused this problem?  I can't get the
clock example to work:

~/src/gtk/clock$ g++ `pkg-config --cflags --libs gtkmm-2.4`
`pkg-config --cflags --libs cairomm-1.0` -g clock.cc main.cc
~/src/gtk/clock$ ./a.out
./a.out: symbol lookup error: ./a.out: undefined symbol:
_ZN3Gdk8Drawable20create_cairo_contextEv

I found a workaround:
Instead of
m_cairo_context = widget.get_window()->create_cairo_context();
Use
m_cairo_context = Cairo::RefPtr<Cairo::Context>(new
Cairo::Context(gdk_cairo_create(widget.get_window()->gobj())));

In case anybody else runs into the same problem.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
You're probably trying to link against a too-old version of gtkmm (?)  I
believe the gdk_cairo_create() function was added in GTK+ 2.6, but it
wasn't
wrapped until the next release of gtkmm (due to the fact that cairomm
wasn't
yet stable in time for gtkmm-2.6)

* I might not have the version numbers exactly correct, but I know for
sure
that there was a 1-version gap between when cairo support was added to
GTK+
and when it was added to gtkmm.

--
jonner


Exactly which version do I have / which file do I need to upgrade?
(gtkmm numbering has me completely confused.)

ii  libgtkmm-2.4-1c2a           1:2.12.5-2                  C++
wrappers for GTK+ 2.4 (shared libraries)
ii  libgtkmm-2.4-dev            1:2.12.5-2                  C++
wrappers for GTK+ 2.4 (development files)
ii  libgtkmm-2.4-doc            1:2.12.5-2                  C++
wrappers for GTK+ 2.4 (documentation)
ii  libcairomm-1.0-1            1.4.2-1                     C++
wrappers for Cairo (shared libraries)
ii  libcairomm-1.0-dev          1.4.2-1                     C++
wrappers for Cairo (development files)
ii  libcairomm-1.0-doc          1.4.2-1                     C++
wrappers for Cairo (documentation)
Those versions should all be plenty new.  I just double-checked and
create_cairo_context() was added in gtkmm 2.10 and you have 2.12 (you can be
more sure about what version you're linking against by running `pkg-config
--modversion gtkmm-2.4`)

btw, the second pkg-config invocation (the one for cairomm-1.0) is not
necessary since gtkmm will pull that in automatically.

Also, I just noticed that this error is not occurring at link time, but
instead at runtime.  that seems very strange... maybe your environment is
broken and you need to set LD_LIBRARY_PATH or something?

$ echo "($LD_LIBRARY_PATH)"
()

$ ldd clock | grep cairo
	libcairomm-1.0.so.1 => /usr/lib/libcairomm-1.0.so.1 (0xb7829000)
	libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb77b7000)
	libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb7712000)

$ ls -l /usr/lib/*cairo*
-rw-r--r-- 1 root root 617510 2008-06-04 11:45 /usr/lib/libcairo.a
-rw-r--r-- 1 root root    875 2008-06-04 11:45 /usr/lib/libcairo.la
-rw-r--r-- 1 root root 126960 2007-10-23 14:50 /usr/lib/libcairomm-1.0.a
-rw-r--r-- 1 root root    924 2007-10-23 14:50 /usr/lib/libcairomm-1.0.la
lrwxrwxrwx 1 root root     23 2008-04-29 05:30
/usr/lib/libcairomm-1.0.so -> libcairomm-1.0.so.1.1.0
lrwxrwxrwx 1 root root     23 2008-04-29 05:30
/usr/lib/libcairomm-1.0.so.1 -> libcairomm-1.0.so.1.1.0
-rw-r--r-- 1 root root 103332 2007-10-23 14:50 /usr/lib/libcairomm-1.0.so.1.1.0
lrwxrwxrwx 1 root root     18 2008-07-05 21:49 /usr/lib/libcairo.so ->
libcairo.so.2.17.3
lrwxrwxrwx 1 root root     18 2008-07-05 21:49 /usr/lib/libcairo.so.2
-> libcairo.so.2.17.3
-rw-r--r-- 1 root root 396284 2008-06-04 11:45 /usr/lib/libcairo.so.2.17.3
-rw-r--r-- 1 root root  44602 2008-07-09 11:23 /usr/lib/libpangocairo-1.0.a
-rw-r--r-- 1 root root    846 2008-07-09 11:23 /usr/lib/libpangocairo-1.0.la
lrwxrwxrwx 1 root root     29 2008-07-19 22:00
/usr/lib/libpangocairo-1.0.so -> libpangocairo-1.0.so.0.2002.3
lrwxrwxrwx 1 root root     29 2008-07-19 22:00
/usr/lib/libpangocairo-1.0.so.0 -> libpangocairo-1.0.so.0.2002.3
-rw-r--r-- 1 root root  34904 2008-07-09 11:23
/usr/lib/libpangocairo-1.0.so.0.2002.3

$ ldd clock | grep gtkmm
	libgtkmm-2.4.so.1 => /usr/local/lib/libgtkmm-2.4.so.1 (0xb7cac000)

$ ls -l /usr/local/lib/libgtkmm*
lrwxrwxrwx 1 root root       22 2007-11-14 13:02
/usr/local/lib/libgtkmm-2.4.so.1 -> libgtkmm-2.4.so.1.0.29
-rwxr-xr-x 1 root root 12550005 2006-08-06 06:27
/usr/local/lib/libgtkmm-2.4.so.1.0.29

$ locate libgtkmm | grep -v "/usr/share/doc" | grep -v "/var/lib/dpkg"
| xargs ls -lrd
-rw-r--r-- 1 root    root     2130756 2008-02-27 13:04
/var/cache/apt/archives/libgtkmm-2.4-dev_1%3a2.12.5-2_i386.deb
-rw-r--r-- 1 root    root     1107262 2008-02-27 13:04
/var/cache/apt/archives/libgtkmm-2.4-1c2a_1%3a2.12.5-2_i386.deb
-rwxr-xr-x 1 root    root    12550005 2006-08-06 06:27
/usr/local/lib/libgtkmm-2.4.so.1.0.29
lrwxrwxrwx 1 root    root          22 2007-11-14 13:02
/usr/local/lib/libgtkmm-2.4.so.1 -> libgtkmm-2.4.so.1.0.29
-rw-r--r-- 1 root    root     3406504 2008-02-27 12:59
/usr/lib/libgtkmm-2.4.so.1.0.30
lrwxrwxrwx 1 root    root          22 2008-09-27 12:53
/usr/lib/libgtkmm-2.4.so.1 -> libgtkmm-2.4.so.1.0.30
lrwxrwxrwx 1 root    root          22 2008-09-27 12:53
/usr/lib/libgtkmm-2.4.so -> libgtkmm-2.4.so.1.0.30
-rw-r--r-- 1 root    root         823 2008-02-27 12:58 /usr/lib/libgtkmm-2.4.la
-rw-r--r-- 1 root    root     5288526 2008-02-27 12:58 /usr/lib/libgtkmm-2.4.a

$ dpkg-query -S libgtkmm-2.4.so.1.0.29
dpkg: *libgtkmm-2.4.so.1.0.29* not found.
$ dpkg-query -S libgtkmm-2.4.so.1.0.30
libgtkmm-2.4-1c2a: /usr/lib/libgtkmm-2.4.so.1.0.30


So, could having 1.0.29 and 1.0.30 be confusing it?  Can I just delete
the 1.0.29 files, or do I need to do anything else?

The important library is actually gdkmm, since the missing symbol is from gdkmm. Though the version numbers of gtkmm and gdkmm will be the same.

It seems that you have linked against the gtkmm installed in /usr/local/lib, so that could be your problem. I'm not sure what version number 1.0.29 corresponds with. Since gtkmm has not been in the habit of changing the so-version regularly, it could correspond with a number of different versions. You can run

pkg-config --modversion gdkmm-2.4

to see what the release version actually is.

My recommendation is to uninstall the gtkmm from /usr/local and just use your system-installed gtkmm.
--
jonner


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]