By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 2,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

import gtk : gives error message

varuns
P: 39
i have installed following packages in same order as shown

1) python2.5
2) Glib 2.12.12
3) atk-1.9.1
4) cairo 1.4.6
5) pango 1.16.4
6) gtk+-2.10.0
7) pycairo 1.4.0
8) pygobject 2.13.1
9) pygtk-2.8.6

installation succeeds but while importing gtk following error is displayed

Expand|Select|Wrap|Line Numbers
  1. Python 2.5 (r25:51908, Jun  4 2007, 14:10:43)
  2. [GCC 4.1.1] on linux2
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. >>> import gtk
  5. Traceback (most recent call last):
  6.   File "<stdin>", line 1, in <module>
  7.   File "/usr/local/lib/python2.5/site-packages/gtk-2.0/gtk/__init__.py", line 45, in <module>
  8.     from _gtk import *
  9. ImportError: /usr/local/lib/python2.5/site-packages/gtk-2.0/gtk/_gtk.so: undefined symbol: gdk_keyval_convert_case
please help me to solve this problem..

my OS is Ubuntu Linux the edgy 6.10

thanks in advance for your help
Jun 5 '07 #1
Share this Question
Share on Google+
13 Replies


bartonc
Expert 5K+
P: 6,596
I've seen lots of compile troubles such as this, with missing symbols, but no one has ever posted back with their solution to this type of error. I think that if one is good with a compiler and has lots of patience, these types of errors can be chased out.

Thank you for such a detailed list of intalled versions. Perhaps this information will enable someone to assist you.

And please, if you come up with a solution before one is found on this site, wont you help us help others by posting back?

Sorry that I couldn't be of more assistance. There are several *nix Pythoneers who check in on this forum, so keep your fingers crossed.
Jun 5 '07 #2

Smygis
100+
P: 126
Installed everything thru the apt sources or did you compile anything on your own?

Seeing that you are using python 2.5 from 2007 i have to guess you compiled it youreself.

What happens if you try with python2.4?
Jun 5 '07 #3

varuns
P: 39
i have installed pygtk-2.10.4 (not pygtk-2.8.6 as posted in post 1)

the errors r same with 2.4 also
Expand|Select|Wrap|Line Numbers
  1. >>> import gtk
  2. Traceback (most recent call last):
  3.   File "<stdin>", line 1, in ?
  4.   File "gtk/__init__.py", line 48, in ?
  5.     from gtk import _gtk
  6.   File "/usr/lib/python2.4/ihooks.py", line 409, in import_module
  7.     self.ensure_fromlist(m, fromlist)
  8.   File "/usr/lib/python2.4/ihooks.py", line 474, in ensure_fromlist
  9.     submod = self.import_it(sub, subname, m)
  10.   File "/usr/lib/python2.4/ihooks.py", line 495, in import_it
  11.     m = self.loader.load_module(fqname, stuff)
  12.   File "/usr/lib/python2.4/ihooks.py", line 268, in load_module
  13.     m = self.hooks.load_dynamic(name, filename, file)
  14.   File "ltihooks.py", line 50, in load_dynamic
  15.     return ihooks.Hooks.load_dynamic(self, name, filename, file)
  16.   File "/usr/lib/python2.4/ihooks.py", line 172, in load_dynamic
  17.     return imp.load_dynamic(name, filename, file)
  18. ImportError: gtk/.libs/_gtk.so: undefined symbol: gdk_keyval_convert_case
i m installing all these on scratchbox
Jun 6 '07 #4

bartonc
Expert 5K+
P: 6,596
i have installed pygtk-2.10.4 (not pygtk-2.8.6 as posted in post 1)

the errors r same with 2.4 also
Expand|Select|Wrap|Line Numbers
  1. >>> import gtk
  2. Traceback (most recent call last):
  3.   File "<stdin>", line 1, in ?
  4.   File "gtk/__init__.py", line 48, in ?
  5.     from gtk import _gtk
  6.   File "/usr/lib/python2.4/ihooks.py", line 409, in import_module
  7.     self.ensure_fromlist(m, fromlist)
  8.   File "/usr/lib/python2.4/ihooks.py", line 474, in ensure_fromlist
  9.     submod = self.import_it(sub, subname, m)
  10.   File "/usr/lib/python2.4/ihooks.py", line 495, in import_it
  11.     m = self.loader.load_module(fqname, stuff)
  12.   File "/usr/lib/python2.4/ihooks.py", line 268, in load_module
  13.     m = self.hooks.load_dynamic(name, filename, file)
  14.   File "ltihooks.py", line 50, in load_dynamic
  15.     return ihooks.Hooks.load_dynamic(self, name, filename, file)
  16.   File "/usr/lib/python2.4/ihooks.py", line 172, in load_dynamic
  17.     return imp.load_dynamic(name, filename, file)
  18. ImportError: gtk/.libs/_gtk.so: undefined symbol: gdk_keyval_convert_case
i m installing all these on scratchbox
My friend, smygis, makes a good point:
"Python 2.5 (r25:51908, Jun 4 2007, 14:10:43)" looks like you have compiled a subversion.
On Windows we get a clear message stating that packages won't run with a particular version of python. Trying the packages that you have with Python 2.4 is certainly worth a shot.
Jun 6 '07 #5

varuns
P: 39
After a long search, i have got some hint regarding why it gives error of Undefined symbol: gdk_keyval_convert_case

Its because i want to use gtk+ with directfb as target not the default target - X11. Currently the function gdk_keyval_convert_case is not defined in GDK-DFB ie in file gdk/direcfb/gdkkeys-directfb.c

I looked at x11 support and there its wrapped with #ifdef HAVE_XCONVERTCASE.

So now i m looking to find a solution for that until its supported by gtk-dfb.
Jun 8 '07 #6

bartonc
Expert 5K+
P: 6,596
After a long search, i have got some hint regarding why it gives error of Undefined symbol: gdk_keyval_convert_case

Its because i want to use gtk+ with directfb as target not the default target - X11. Currently the function gdk_keyval_convert_case is not defined in GDK-DFB ie in file gdk/direcfb/gdkkeys-directfb.c

I looked at x11 support and there its wrapped with #ifdef HAVE_XCONVERTCASE.

So now i m looking to find a solution for that until its supported by gtk-dfb.
Thank you so much for keeping us up-to-date! This is sure to help others in the near future and beyond.
Jun 8 '07 #7

varuns
P: 39
i got a solution so i have just copied it here
i tried it but didn't worked on my machine
may be it will be helpful to other. Its from a solution posted on a forum


Hello,

Attilio Fiandrotti wrote:
> patrickd at vmware.com wrote:
>> Hey guys,
>>
>> I'm trying to get pygtk to work with the GTK-DFB project and so far have
>> run into some stumbling blocks. I've gotten DirectFB to work and can get
>> gtk-demo to run from the directions given at the GTK_on_DirectFB wiki
>> page.
>>
>> I recompiled the pygtk-2.8.6 source using the
>> PREFIX/LD_LIBRARY_PATH/PKG_CONFIG_PATH env settings recommended on the
>> GTK-DFB wiki page and used:
>>
>> ./configure --prefix=$PREFIX --without-x
>>
>> to build it. I set up PYTHONPATH to use $PREFIX/lib/python2.4 and
>> $PREFIX/lib/python2.4/site-packages/gtk-2.0. So far I seem to be able to
>> almost get it to work, however when I try to import gtk in python I run
>> into this error:
>>
>>
>>>>> import gtk
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> File "/usr/gtkdfb/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line 45, in ?
>> from _gtk import *
>> ImportError: /usr/gtkdfb/lib/python2.4/site-packages/gtk-2.0/gtk/_gtk.so: undefined symbol: gdk_keyval_convert_case
>>
>> I'm I correct in assuming gdk_keyval_convert_case isn't yet implemented in
>> GTK-DFB? I haven't yet started pulling apart the source.
>
> gdk_keyval_convert_case is an empty stub and currently is commented out
> in gdkkeys-directfb.c (i dunno why, but you could try to uncomment it):
> what version of gtkdfb are you using (you should be using mainstream
> version 2.9 from cvs.gnome.org) ?

I have a fresh SVN checkout from the trunk and gdk_keyval_convert_case
seems to be completely removed from gdk/directfb/gdkkeys-directfb.c. I
was looking in the x11 support and there it is wrapped with an #ifdef
HAVE_XCONVERTCASE. Maybe a simple solution for now would be to put the
same ifdef (if it's available there) in pygtk. I know that's not fixing
the problem the right way but maybe a quick hack until it is supported
by gtk-dfb.

-Rob
I ran into the same problem when I looked at doing this about 6 months ago
and haven't had time to pick it back up again. Pygtk support would be
really, really, really nice to have.

--Patrick.


On Thu, 11 Jan 2007, Rob Shortt wrote:

> Hello,
>
> Attilio Fiandrotti wrote:
>> patrickd at vmware.com wrote:
>>> Hey guys,
>>>
>>> I'm trying to get pygtk to work with the GTK-DFB project and so far have
>>> run into some stumbling blocks. I've gotten DirectFB to work and can get
>>> gtk-demo to run from the directions given at the GTK_on_DirectFB wiki
>>> page.
>>>
>>> I recompiled the pygtk-2.8.6 source using the
>>> PREFIX/LD_LIBRARY_PATH/PKG_CONFIG_PATH env settings recommended on the
>>> GTK-DFB wiki page and used:
>>>
>>> ./configure --prefix=$PREFIX --without-x
>>>
>>> to build it. I set up PYTHONPATH to use $PREFIX/lib/python2.4 and
>>> $PREFIX/lib/python2.4/site-packages/gtk-2.0. So far I seem to be able to
>>> almost get it to work, however when I try to import gtk in python I run
>>> into this error:
>>>
>>>
>>>>>> import gtk
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in ?
>>> File "/usr/gtkdfb/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py",
>>> line 45, in ?
>>> from _gtk import *
>>> ImportError: /usr/gtkdfb/lib/python2.4/site-packages/gtk-2.0/gtk/_gtk.so:
>>> undefined symbol: gdk_keyval_convert_case
>>>
>>> I'm I correct in assuming gdk_keyval_convert_case isn't yet implemented in
>>> GTK-DFB? I haven't yet started pulling apart the source.
>>
>> gdk_keyval_convert_case is an empty stub and currently is commented out in
>> gdkkeys-directfb.c (i dunno why, but you could try to uncomment it): what
>> version of gtkdfb are you using (you should be using mainstream version 2.9
>> from cvs.gnome.org) ?
>
> I have a fresh SVN checkout from the trunk and gdk_keyval_convert_case seems
> to be completely removed from gdk/directfb/gdkkeys-directfb.c. I was looking
> in the x11 support and there it is wrapped with an #ifdef HAVE_XCONVERTCASE.
> Maybe a simple solution for now would be to put the same ifdef (if it's
> available there) in pygtk. I know that's not fixing the problem the right
> way but maybe a quick hack until it is supported by gtk-dfb.
>
> -Rob
>
Patrick Devine wrote:
> I ran into the same problem when I looked at doing this about 6 months ago
> and haven't had time to pick it back up again. Pygtk support would be
> really, really, really nice to have.

I agree. I've been working all day at this: cairo-1.3.10 snapshot,
pycairo from CVS; pango, gtk+, pygobject, pygtk from SVN.

I spent some time on gtk+ figuring out how the symbols work there:

Index: gdk/gdk.symbols
================================================== =================
--- gdk/gdk.symbols (revision 17133)
+++ gdk/gdk.symbols (working copy)
@@ -796,6 +796,7 @@
gdk_keyval_is_upper G_GNUC_CONST
gdk_keyval_to_lower G_GNUC_CONST
gdk_keyval_to_upper G_GNUC_CONST
+gdk_keyval_convert_case
#endif
#endif


Basicly I think that tells it to use the gdk_keyval_convert_case from
gdk/gdkkeys.c and not one implimented in gdk/directfb.

I thought I would be home free now but python -c "import gtk" segfaults
on me now, for what reason is unknown.. it may not even be related. I'm
starting to get discouraged here but willing to continue if others are
on board. I may put the stub of gdk_keyval_convert_case back into
gdkkeys-directfb.c and move the symbols entry to correspond, maybe that
will help.

-Rob
Rob Shortt wrote:
> I thought I would be home free now but python -c "import gtk" segfaults
> on me now, for what reason is unknown.. it may not even be related. I'm
> starting to get discouraged here but willing to continue if others are
> on board. I may put the stub of gdk_keyval_convert_case back into
> gdkkeys-directfb.c and move the symbols entry to correspond, maybe that
> will help.

I just tried that, and also removed the corresponding binding from
pygtk, still segfaults. Time to find out how to run this through gdb I
guess.

-Rob
Rob Shortt wrote:
> Patrick Devine wrote:
>
>>I ran into the same problem when I looked at doing this about 6 months ago
>>and haven't had time to pick it back up again. Pygtk support would be
>>really, really, really nice to have.
>
>
> I agree. I've been working all day at this: cairo-1.3.10 snapshot,
> pycairo from CVS; pango, gtk+, pygobject, pygtk from SVN.
>
> I spent some time on gtk+ figuring out how the symbols work there:
>
> Index: gdk/gdk.symbols
> ================================================== =================
> --- gdk/gdk.symbols (revision 17133)
> +++ gdk/gdk.symbols (working copy)
> @@ -796,6 +796,7 @@
> gdk_keyval_is_upper G_GNUC_CONST
> gdk_keyval_to_lower G_GNUC_CONST
> gdk_keyval_to_upper G_GNUC_CONST
> +gdk_keyval_convert_case
> #endif
> #endif
>
>
> Basicly I think that tells it to use the gdk_keyval_convert_case from
> gdk/gdkkeys.c and not one implimented in gdk/directfb.
>
> I thought I would be home free now but python -c "import gtk" segfaults
> on me now, for what reason is unknown.. it may not even be related. I'm
> starting to get discouraged here but willing to continue if others are
> on board. I may put the stub of gdk_keyval_convert_case back into
> gdkkeys-directfb.c and move the symbols entry to correspond, maybe that
> will help.

Hi

Grep'ing the directfb dir and looking at the directfb TODO file, i see
that gdk_keyval_convert_case() has not been implemented yet: since Mike
Emmel should be commiting a round of patches i sent him recently, could
you try to write a patch that provides the missing gdk function without
relying on XConvertCase (do we have somthing similar in DFB ?).
For the short term a simple empty stub may do.

About the crash you are experiencing with python gtk bindings, could it
be that's because those bindings are bound to gtk/x11 and not gtk/dfb ?
pherhaps you need rebuilding against gtk/dfb? just a hypotesis..

cheers

Attilio
Attilio Fiandrotti wrote:
> Grep'ing the directfb dir and looking at the directfb TODO file, i see
> that gdk_keyval_convert_case() has not been implemented yet: since Mike
> Emmel should be commiting a round of patches i sent him recently, could
> you try to write a patch that provides the missing gdk function without
> relying on XConvertCase (do we have somthing similar in DFB ?).

I am not sure about the DirectFB equivalent.


> For the short term a simple empty stub may do.

In my copy I've added the stub back:

Index: gdk/directfb/gdkkeys-directfb.c
================================================== =================
--- gdk/directfb/gdkkeys-directfb.c (revision 17133)
+++ gdk/directfb/gdkkeys-directfb.c (working copy)
@@ -2008,6 +2008,14 @@
return 0;
}

+void
+gdk_keyval_convert_case (guint symbol,
+ guint *lower,
+ guint *upper)
+{
+
+ g_warning("Unimplemented: gdk_keyval_convert_case\n");
+}

#define __GDK_KEYS_DIRECTFB_C__
#include "gdkaliasdef.c"
Index: gdk/gdk.symbols
================================================== =================
--- gdk/gdk.symbols (revision 17133)
+++ gdk/gdk.symbols (working copy)
@@ -828,6 +828,7 @@
gdk_keymap_get_for_display
gdk_keymap_lookup_key
gdk_keymap_translate_keyboard_state
+gdk_keyval_convert_case
gdk_keyval_from_name
gdk_keyval_name G_GNUC_CONST
#endif


But doing this conflicts with the gdk_keyval_convert_case() in
gdk/gdkkeys.c. This isn't an issue with the one in the x11 support
because one is wrapped in #ifndef HAVE_XCONVERTCASE and the other in
#ifdef HAVE_XCONVERTCASE. That must be defined on my system, I have
some x libs and headers installed (but am NOT building the x11 backend).
As a quick hack I simply removed the function in gdkkeyc.c.

>
> About the crash you are experiencing with python gtk bindings, could it
> be that's because those bindings are bound to gtk/x11 and not gtk/dfb ?
> pherhaps you need rebuilding against gtk/dfb? just a hypotesis..

No, I've built them fresh against gtk/dfb.

-Rob
Hi, I just wanted to post an update.

Attached is the patch I am using to add gdk_keyval_convert_case() into
the directfb backend. I noticed something while running gtk-demo with
this patch. I get the message "Unimplemented: gdk_keyval_convert_case"
which makes perfect sense, then the demo exits (I don't see the demo).
The first thing I realized is that I ran the demo successfully earlier,
and I verified this by reversing my patch.

Ok, back to the original problem. After reverting everything:

# python -c "import gtk"
Traceback (most recent call last):
File "<string>", line 1, in ?
File
"/usr/local/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line
48, in ?
from gtk import _gtk
ImportError: /usr/local/lib/python2.4/site-packages/gtk-2.0/gtk/_gtk.so:
undefined symbol: gdk_keyval_convert_case

BUT, that symbol IS defined. I can run gtk-demo again, and it works. I
do not get the "Unimplemented: gdk_keyval_convert_case" message. I
think that the problem lies with either how gtk+ exposes its symbols or
how pygtk is using the library. In gtk+ I am going to look closer at
the relationship between the backend implimentations and the generic
functions, also with gdk/gdk.symbols and gdk/gdkalias.h /
gdk/gdkaliasdef.c.

-Rob
Rob Shortt wrote:
> Hi, I just wanted to post an update.
>
> Attached is the patch I am using to add gdk_keyval_convert_case() into
> the directfb backend. I noticed something while running gtk-demo with
> this patch. I get the message "Unimplemented: gdk_keyval_convert_case"
> which makes perfect sense, then the demo exits (I don't see the demo).
> The first thing I realized is that I ran the demo successfully earlier,
> and I verified this by reversing my patch.

<snip/>

Uhm, if the gtk-demo app cannot start and exits with a crash after
applying the patch, then i think there must be somtheing wrong in your
patch that maybe also causes py-gtk to crash.
I think you should first get a working gtk-demo with patched gtk/dfb,
and later work on the py-gtk side

regards

Attilio
Attilio Fiandrotti wrote:
> Rob Shortt wrote:
>> Hi, I just wanted to post an update.
>>
>> Attached is the patch I am using to add gdk_keyval_convert_case() into
>> the directfb backend. I noticed something while running gtk-demo with
>> this patch. I get the message "Unimplemented: gdk_keyval_convert_case"
>> which makes perfect sense, then the demo exits (I don't see the demo).
>> The first thing I realized is that I ran the demo successfully earlier,
>> and I verified this by reversing my patch.
>
> <snip/>
>
> Uhm, if the gtk-demo app cannot start and exits with a crash after
> applying the patch, then i think there must be somtheing wrong in your
> patch that maybe also causes py-gtk to crash.

Yes, that's what I was getting at. :) I was only pointing out what I
had done (and undone).

> I think you should first get a working gtk-demo with patched gtk/dfb,
> and later work on the py-gtk side

Gtk-demo is back to working state and also by adding the symbol to
gdk/gdk.symbols I got rid of the undefined symbol error in pygtk. Now
the segfault is occurring there and I have found the problem.

See this backtrace of python -c "import gtk":

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209919808 (LWP 3797)]
0xb7e8e783 in strlen () from /lib/tls/libc.so.6
(gdb) bt
#0 0xb7e8e783 in strlen () from /lib/tls/libc.so.6
#1 0x080840ea in PyString_FromString ()
#2 0xb7a6899b in init_gtk () at gtkmodule.c:134
#3 0x080d631c in _PyImport_LoadDynamicModule ()
#4 0x080d4315 in PyImport_ExecCodeModule ()
#5 0x080d4a39 in PyImport_ReloadModule ()
#6 0x080d4d60 in PyImport_ReloadModule ()
#7 0x080d52d4 in PyImport_ImportModuleEx ()
#8 0x080afe91 in _PyBuiltin_Init ()
#9 0x080589d7 in PyObject_Call ()
#10 0x080b3d2d in PyEval_CallObjectWithKeywords ()
#11 0x080b7a80 in PyEval_EvalFrame ()
#12 0x080ba745 in PyEval_EvalCodeEx ()
#13 0x080ba7a9 in PyEval_EvalCode ()
#14 0x080d38ec in PyImport_ExecCodeModuleEx ()
#15 0x080d3f66 in PyImport_ExecCodeModule ()
#16 0x080d5876 in PyImport_ImportModule ()
#17 0x080d4a39 in PyImport_ReloadModule ()
#18 0x080d4ee1 in PyImport_ReloadModule ()
#19 0x080d50ee in PyImport_ImportModuleEx ()
#20 0x080afe91 in _PyBuiltin_Init ()
#21 0x080589d7 in PyObject_Call ()
#22 0x080b3d2d in PyEval_CallObjectWithKeywords ()
#23 0x080b7a80 in PyEval_EvalFrame ()
#24 0x080ba745 in PyEval_EvalCodeEx ()
#25 0x080ba7a9 in PyEval_EvalCode ()
#26 0x080dc995 in PyRun_InteractiveOneFlags ()
#27 0x080dcab0 in PyRun_InteractiveLoopFlags ()
#28 0x080dd5b2 in PyRun_AnyFileExFlags ()
#29 0x08055ba8 in Py_Main ()
#30 0x08055032 in main ()


OK, gtkmodule.c line 134, we're looking at code like this:

/* Add predefined atoms */
#define add_atom(name) { aname = gdk_atom_name((GDK_##name)); \
printf("DEBUG: %s\n", #name); \
printf("DEBUG: %s\n", aname); \
/* PyModule_AddObject(m, #name, PyString_FromString(aname)); */ \
g_free(aname); }

add_atom(SELECTION_PRIMARY);
add_atom(SELECTION_SECONDARY);


FYI, I added the DEBUG prints. Here gdk_atom_name() is returning NULL,
forcing the segfault. I need to figure out why all these are NULL for
gtk-directfb. I may have to move this to a different mailing list...
do you know the maintainer for gtk-directfb? I need to understand the
gtk internals a bit more and how the backends relate to the core.

With my DEBUGs, here is the output of python -c "import gtk":

# python -c "import gtk"
DEBUG: SELECTION_PRIMARY
DEBUG: (null)
DEBUG: SELECTION_SECONDARY
DEBUG: (null)
DEBUG: SELECTION_CLIPBOARD
DEBUG: (null)
DEBUG: TARGET_BITMAP
DEBUG: (null)
DEBUG: TARGET_COLORMAP
DEBUG: (null)
DEBUG: TARGET_DRAWABLE
DEBUG: (null)
DEBUG: TARGET_PIXMAP
DEBUG: (null)
DEBUG: TARGET_STRING
DEBUG: (null)
DEBUG: SELECTION_TYPE_ATOM
DEBUG: (null)
DEBUG: SELECTION_TYPE_BITMAP
DEBUG: (null)
DEBUG: SELECTION_TYPE_COLORMAP
DEBUG: (null)
DEBUG: SELECTION_TYPE_DRAWABLE
DEBUG: (null)
DEBUG: SELECTION_TYPE_INTEGER
DEBUG: (null)
DEBUG: SELECTION_TYPE_PIXMAP
DEBUG: (null)
DEBUG: SELECTION_TYPE_WINDOW
DEBUG: (null)
DEBUG: SELECTION_TYPE_STRING
DEBUG: (null)

=======================| DirectFB 1.0.0-rc3 |=======================
(c) 2001-2006 United Cultures of Earth - go for outer space!
(c) 2000-2004 Convergence (integrated media) GmbH
----------------------------------------------------------------

(*) DirectFB/Core: Multi Application Core. (2007-01-02 03:03)
(*) Direct/Thread: Running 'Fusion Dispatch' (MESSAGING, 12772)...
(*) DirectFB/Core: doing sync()...
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: VIA/S3G CLE266/UniChrome 0.4 (-)

(-c:12770): Gdk-CRITICAL **: gdk_drawable_set_colormap: assertion `cmap
== NULL || gdk_drawable_get_depth (drawable) == cmap->visual->depth' failed
(*) Direct/Thread: Running 'EventBufferFeed' (MESSAGING, 12773)...
(!!!) *** WARNING [Application exited without deinitialization of
DirectFB!] *** [core.c:745 in dfb_core_deinit_check()]
(!) Direct/Thread: Canceling 'Fusion Dispatch' (12772)!



Thanks,
-Rob
Rob Shortt wrote:
> Attilio Fiandrotti wrote:

<snip/>

>>I think you should first get a working gtk-demo with patched gtk/dfb,
>>and later work on the py-gtk side
>
>
> Gtk-demo is back to working state and also by adding the symbol to
> gdk/gdk.symbols I got rid of the undefined symbol error in pygtk. Now
> the segfault is occurring there and I have found the problem.
>
> See this backtrace of python -c "import gtk":
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1209919808 (LWP 3797)]
> 0xb7e8e783 in strlen () from /lib/tls/libc.so.6
> (gdb) bt
> #0 0xb7e8e783 in strlen () from /lib/tls/libc.so.6
> #1 0x080840ea in PyString_FromString ()
> #2 0xb7a6899b in init_gtk () at gtkmodule.c:134
> #3 0x080d631c in _PyImport_LoadDynamicModule ()
> #4 0x080d4315 in PyImport_ExecCodeModule ()
> #5 0x080d4a39 in PyImport_ReloadModule ()
> #6 0x080d4d60 in PyImport_ReloadModule ()
> #7 0x080d52d4 in PyImport_ImportModuleEx ()
> #8 0x080afe91 in _PyBuiltin_Init ()
> #9 0x080589d7 in PyObject_Call ()
> #10 0x080b3d2d in PyEval_CallObjectWithKeywords ()
> #11 0x080b7a80 in PyEval_EvalFrame ()
> #12 0x080ba745 in PyEval_EvalCodeEx ()
> #13 0x080ba7a9 in PyEval_EvalCode ()
> #14 0x080d38ec in PyImport_ExecCodeModuleEx ()
> #15 0x080d3f66 in PyImport_ExecCodeModule ()
> #16 0x080d5876 in PyImport_ImportModule ()
> #17 0x080d4a39 in PyImport_ReloadModule ()
> #18 0x080d4ee1 in PyImport_ReloadModule ()
> #19 0x080d50ee in PyImport_ImportModuleEx ()
> #20 0x080afe91 in _PyBuiltin_Init ()
> #21 0x080589d7 in PyObject_Call ()
> #22 0x080b3d2d in PyEval_CallObjectWithKeywords ()
> #23 0x080b7a80 in PyEval_EvalFrame ()
> #24 0x080ba745 in PyEval_EvalCodeEx ()
> #25 0x080ba7a9 in PyEval_EvalCode ()
> #26 0x080dc995 in PyRun_InteractiveOneFlags ()
> #27 0x080dcab0 in PyRun_InteractiveLoopFlags ()
> #28 0x080dd5b2 in PyRun_AnyFileExFlags ()
> #29 0x08055ba8 in Py_Main ()
> #30 0x08055032 in main ()
>
>
> OK, gtkmodule.c line 134, we're looking at code like this:
>
> /* Add predefined atoms */
> #define add_atom(name) { aname = gdk_atom_name((GDK_##name)); \
> printf("DEBUG: %s\n", #name); \
> printf("DEBUG: %s\n", aname); \
> /* PyModule_AddObject(m, #name, PyString_FromString(aname)); */ \
> g_free(aname); }
>
> add_atom(SELECTION_PRIMARY);
> add_atom(SELECTION_SECONDARY);
>
>
> FYI, I added the DEBUG prints. Here gdk_atom_name() is returning NULL,
> forcing the segfault. I need to figure out why all these are NULL for
> gtk-directfb. I may have to move this to a different mailing list...
> do you know the maintainer for gtk-directfb? I need to understand the
> gtk internals a bit more and how the backends relate to the core.

</snip>

ok, we had cases of crashes in gtk/dfb similar to this in the past: this
seems to be a gtk issue, so the correct mailing list to ask for advice
is gtk-devel [1].
I think you should report here the issue you've found (only the
gdk_atom() stuff, letting go the pygtk backgound) and ask if it's ok for
gdk_atom_name() to return NULL: in this case gtkmodule should free aname
only if != NULL.
Otherwise we'll need to patch gtk/dfb to never return NULL from
gdk_atom_name().
Current maintainer for gtk/dfb is Mike Emmel, former maintainer and
author is Sven Neumann, both are subscribed to both gtk-devel and
directfb-dev.

cheers

Attilio
Jun 19 '07 #8

varuns
P: 39
hi
finally i got the solution to this problem
no need to look at previous post

open file pygtk-x.x/gtk/gdk.override
search "ignore" in it
than add gdk_keyval_convert_case in that block
it should than look like this
%%
ignore
gdk_window_set_debug_updates
gdk_region_destroy
gdk_atom_intern_static_string
gdk_pixbuf_from_pixdata
gdk_keyval_convert_case
%%

Make a change also in gtk+/gdk/directfb/gdkproperty-directfb.c
search for function gdk_atom_name and replace all statements with these
statements so that it looks like

gchar *
gdk_atom_name (GdkAtom atom)
{
if (!atoms_to_names)
ensure_atom_tables();

if (GPOINTER_TO_INT (atom)-1 >= atoms_to_names->len)
return NULL;
return g_strdup(g_ptr_array_index (atoms_to_names,
GPOINTER_TO_INT(atom)-1));
}

after making changes first make install gtk again
than proceed as shown
1. cd pygobject && ./configure PYTHON=pythonx.x && make && make install
(x.x is version of python currently installed)
2. cd pygtk && ./configure PYTHON=pythonx.x && make && make install


cheers
varun
Aug 10 '07 #9

P: 3
this solution didn't work for me (probably me doing
something not right)

I still get the following error
ImportError: /usr/gtkdfb/src/pygtk-2.10.0/gtk/.libs/_gtk.so: undefined symbol: gdk_keyval_convert_case

GTK-directfb is working correctly with the
regular /usr/gtkdfb/bin/gtk-demo.
Also pygtk is working with the GTK bound to X.

I modified the C sources, re- configured
and re-installed both GTK and pygtk but still
the same error. Any ideas what I might have
wrong?

thanks
John


hi
finally i got the solution to this problem
no need to look at previous post

open file pygtk-x.x/gtk/gdk.override
search "ignore" in it
than add gdk_keyval_convert_case in that block
it should than look like this
%%
ignore
gdk_window_set_debug_updates
gdk_region_destroy
gdk_atom_intern_static_string
gdk_pixbuf_from_pixdata
gdk_keyval_convert_case
%%

Make a change also in gtk+/gdk/directfb/gdkproperty-directfb.c
search for function gdk_atom_name and replace all statements with these
statements so that it looks like

gchar *
gdk_atom_name (GdkAtom atom)
{
if (!atoms_to_names)
ensure_atom_tables();

if (GPOINTER_TO_INT (atom)-1 >= atoms_to_names->len)
return NULL;
return g_strdup(g_ptr_array_index (atoms_to_names,
GPOINTER_TO_INT(atom)-1));
}

after making changes first make install gtk again
than proceed as shown
1. cd pygobject && ./configure PYTHON=pythonx.x && make && make install
(x.x is version of python currently installed)
2. cd pygtk && ./configure PYTHON=pythonx.x && make && make install


cheers
varun
Sep 6 '07 #10

varuns
P: 39
ImportError: /usr/gtkdfb/src/pygtk-2.10.0/gtk/.libs/_gtk.so: undefined symbol: gdk_keyval_convert_case
can you post what r the steps you have taken to install pygtk.
Sep 7 '07 #11

P: 3
Ok, here is my setup...
I followed the example of getting GTK on Directfb from source:

http://www.directfb.org/wiki/index.php/Projects:GTK_on_DirectFB

I installed pango-1.15.3, Python-2.4.4, pygobject-2.13.0,
cairo-1.4.6, gtk+-2.10.13 and pygtk-2.10.0

I set up environment variables
export PREFIX=/usr/gtkdfb
export LD_LIBRARY_PATH=$PREFIX/lib
export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
export CFLAGS="-g"

then untarred, configure, make, make install with
the options as follows.

For cairo
configure --prefix=$PREFIX --enable-directfb --disable-xlib --disable-win32

For gtk
configure --prefix=$PREFIX --with-gdktarget=directfb --without-x

for others, used no extra options

After installing, when I run
/usr/gtkdfb/bin/gtk-demo
works correctly; I get gtk demo within a directfb framebuffer and no
X frills.

I applied the fixes to the source files, then re-installed
gtk and pygtk.
Still getting the error

ImportError: /usr/local/lib/python2.5/site-packages/gtk-2.0/gtk/_gtk.so: undefined symbol: gdk_keyval_convert_case

I tried adding the dummy function as recommended by earlier post
to make it non-blank but C compiler complained that it was already
defined etc.

Thanks for any help.
pygtk+directfb would be a great combination to help embedded
system development.

John






can you post what r the steps you have taken to install pygtk.
Sep 7 '07 #12

varuns
P: 39
[quote=
for others, used no extra options

[/QUOTE]

every thing seems to be correct

have you installed pygobject and pygtk as given below, if so it should work.

1. cd pygobject && ./configure --prefix=$PREFIX PYTHON=pythonx.x && make && make install
(x.x is version of python currently installed)
2. cd pygtk && ./configure --prefix=$PREFIX PYTHON=pythonx.x && make && make install
Sep 7 '07 #13

P: 3
Ok, thanks I got it to work with the changes
you suggested.
I had some leftover symlinks to the fedora
GTK system and libraries.

pygtk on directfb is a very useful package
for embedded - way smaller than java + X
Calculate it <10 Mbytes for the whole
working system as replacement for X and Java.
Sep 11 '07 #14

Post your reply

Sign in to post your reply or Sign up for a free account.