problem compiling wxPython on linux

Hi,
I compiled successfuly wxGTK and wxPython without problems. Then I go to wxPython source dir to wxPython and launch python setup.py install and I get this (python is fot python2.3):

In file included from /usr/include/gtk-1.2/gdk/gdk.h:31,
                 from /usr/include/gtk-1.2/gtk/gtk.h:31,
                 from src/helpers.cpp:26:
/usr/include/gtk-1.2/gdk/gdktypes.h:52: error: conflicting types for `typedef
   gulong GdkAtom'
/usr/local/include/wx/defs.h:2372: error: previous declaration as `typedef
   struct _GdkAtom*GdkAtom'
/usr/include/gtk-1.2/gdk/gdktypes.h:57: error: conflicting types for `typedef
   struct _GdkWindow GdkWindow'
/usr/local/include/wx/defs.h:2373: error: previous declaration as `typedef
   struct _GdkDrawable GdkWindow'
/usr/include/gtk-1.2/gdk/gdktypes.h:58: error: conflicting types for `typedef
   struct _GdkWindow GdkPixmap'
/usr/local/include/wx/defs.h:2375: error: previous declaration as `typedef
   struct _GdkDrawable GdkPixmap'
/usr/include/gtk-1.2/gdk/gdktypes.h:59: error: conflicting types for `typedef
   struct _GdkWindow GdkBitmap'
/usr/local/include/wx/defs.h:2374: error: previous declaration as `typedef
   struct _GdkDrawable GdkBitmap'
error: command 'gcc' failed with exit status 1

What does it means? What can I do about it?
Thanks a lot
Petr

Petr Šimon wrote:

Hi,
I compiled successfuly wxGTK and wxPython without problems. Then I go to wxPython source dir to wxPython and launch python setup.py install and I get this (python is fot python2.3):

In file included from /usr/include/gtk-1.2/gdk/gdk.h:31,
                from /usr/include/gtk-1.2/gtk/gtk.h:31,
                from src/helpers.cpp:26:
/usr/include/gtk-1.2/gdk/gdktypes.h:52: error: conflicting types for `typedef
  gulong GdkAtom'
/usr/local/include/wx/defs.h:2372: error: previous declaration as `typedef
  struct _GdkAtom*GdkAtom'
/usr/include/gtk-1.2/gdk/gdktypes.h:57: error: conflicting types for `typedef
  struct _GdkWindow GdkWindow'
/usr/local/include/wx/defs.h:2373: error: previous declaration as `typedef
  struct _GdkDrawable GdkWindow'
/usr/include/gtk-1.2/gdk/gdktypes.h:58: error: conflicting types for `typedef
  struct _GdkWindow GdkPixmap'
/usr/local/include/wx/defs.h:2375: error: previous declaration as `typedef
  struct _GdkDrawable GdkPixmap'
/usr/include/gtk-1.2/gdk/gdktypes.h:59: error: conflicting types for `typedef
  struct _GdkWindow GdkBitmap'
/usr/local/include/wx/defs.h:2374: error: previous declaration as `typedef
  struct _GdkDrawable GdkBitmap'
error: command 'gcc' failed with exit status 1

What does it means? What can I do about it?

IIRC, this happens when you are mixing gtk 1.2 and 2.x somehow. Please show how you configured wxGTK and what some of the actual compile command lines look like.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Petr Šimon wrote:

Hi,
I compiled successfuly wxGTK and wxPython without problems. Then I go to wxPython source dir to wxPython and launch python setup.py install and I get this (python is fot python2.3):

In file included from /usr/include/gtk-1.2/gdk/gdk.h:31,
                from /usr/include/gtk-1.2/gtk/gtk.h:31,
                from src/helpers.cpp:26:
/usr/include/gtk-1.2/gdk/gdktypes.h:52: error: conflicting types for `typedef
  gulong GdkAtom'
/usr/local/include/wx/defs.h:2372: error: previous declaration as `typedef
  struct _GdkAtom*GdkAtom'
/usr/include/gtk-1.2/gdk/gdktypes.h:57: error: conflicting types for `typedef
  struct _GdkWindow GdkWindow'
/usr/local/include/wx/defs.h:2373: error: previous declaration as `typedef
  struct _GdkDrawable GdkWindow'
/usr/include/gtk-1.2/gdk/gdktypes.h:58: error: conflicting types for `typedef
  struct _GdkWindow GdkPixmap'
/usr/local/include/wx/defs.h:2375: error: previous declaration as `typedef
  struct _GdkDrawable GdkPixmap'
/usr/include/gtk-1.2/gdk/gdktypes.h:59: error: conflicting types for `typedef
  struct _GdkWindow GdkBitmap'
/usr/local/include/wx/defs.h:2374: error: previous declaration as `typedef
  struct _GdkDrawable GdkBitmap'
error: command 'gcc' failed with exit status 1

What does it means? What can I do about it?

IIRC, this happens when you are mixing gtk 1.2 and 2.x somehow. Please show how you configured wxGTK and what some of the actual compile command lines look like.

Well,
one issue would be that I don't undestand BUILD and INSTALL documents properly. Now I know that I shouln't be building wxGTK from other package. Which I did. I wanted to install, so I followed the documents
and did same for both wxGTK and wxPythonSrc. Might that have caused the problem. Otherwise I used:
cd bld
../ configure --prefix=/opt/wx/2.5 \
                            --enable-rpath=/opt/wx/2.5/lib \
                             --with-opengl \
                             --disable-monolithic \
                             --enable-optimize \
                             --enable-geometry \
                             --enable-display \
                             --with-gtk --enable-gtk2 --enable-unicode

Thanks a lot
Petr

Petr Šimon wrote:

Well,
one issue would be that I don't undestand BUILD and INSTALL documents properly. Now I know that I shouln't be building wxGTK from other package. Which I did. I wanted to install, so I followed the documents
and did same for both wxGTK and wxPythonSrc. Might that have caused the problem. Otherwise I used:
cd bld
../ configure --prefix=/opt/wx/2.5 \
                           --enable-rpath=/opt/wx/2.5/lib \
                            --with-opengl \
                            --disable-monolithic \
                            --enable-optimize \
                            --enable-geometry \
                            --enable-display \
                            --with-gtk --enable-gtk2 --enable-unicode

Did you also use WXPORT=gtk2 UNICODE=1 on the setup.py command-line?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Petr Šimon wrote:

Robin Dunn wrote:

Petr Šimon wrote:

Robin Dunn wrote:

Petr Šimon wrote:

Well,
one issue would be that I don't undestand BUILD and INSTALL documents properly. Now I know that I shouln't be building wxGTK from other package. Which I did. I wanted to install, so I followed the documents
and did same for both wxGTK and wxPythonSrc. Might that have caused the problem. Otherwise I used:
cd bld
../ configure --prefix=/opt/wx/2.5 \
                           --enable-rpath=/opt/wx/2.5/lib \
                            --with-opengl \
                            --disable-monolithic \
                            --enable-optimize \
                            --enable-geometry \
                            --enable-display \
                            --with-gtk --enable-gtk2 --enable-unicode

Did you also use WXPORT=gtk2 UNICODE=1 on the setup.py command-line?

I run this
> python setup.py install WX_CONFIG=/opt/wx/2.5/bin/wx-config WXPORT=gtk2 UNICODE=1
and get this:
contrib/glcanvas/gtk/glcanvas_wrap.cpp:407: error: `wxGLCanvas' undeclared

Add BUILD_GLCANVAS=0 as described in BUILD.txt

Almost done, but now I get this:
....
byte-compiling /usr/lib/python2.3/site-packages/wxPython/windows.py to windows.pyc
running install_headers
Traceback (most recent call last):
File "setup.py", line 717, in ?
   cmdclass = { 'install_data': wx_smart_install_data,
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/core.py", line 149, in setup
   dist.run_commands()
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/dist.py", line 907, in run_commands
   self.run_command(cmd)
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/dist.py", line 927, in run_command
   cmd_obj.run()
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/command/install.py", line 505, in run
   self.run_command(cmd_name)
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/cmd.py", line 333, in run_command
   self.distribution.run_command(command)
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/dist.py", line 927, in run_command
   cmd_obj.run()
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/config.py", line 411, in run
   if WXPREFIX.startswith(root):
TypeError: expected a character buffer object

Make this change:

http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/wxPython/config.py.diff?r1=1.6&r2=1.7

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Petr Šimon wrote:

Robin Dunn wrote:

Petr Šimon wrote:

Robin Dunn wrote:

Petr Šimon wrote:

Well,
one issue would be that I don't undestand BUILD and INSTALL documents properly. Now I know that I shouln't be building wxGTK from other package. Which I did. I wanted to install, so I followed the documents
and did same for both wxGTK and wxPythonSrc. Might that have caused the problem. Otherwise I used:
cd bld
../ configure --prefix=/opt/wx/2.5 \
                           --enable-rpath=/opt/wx/2.5/lib \
                            --with-opengl \
                            --disable-monolithic \
                            --enable-optimize \
                            --enable-geometry \
                            --enable-display \
                            --with-gtk --enable-gtk2 --enable-unicode

Did you also use WXPORT=gtk2 UNICODE=1 on the setup.py command-line?

I run this
> python setup.py install WX_CONFIG=/opt/wx/2.5/bin/wx-config WXPORT=gtk2 UNICODE=1
and get this:
contrib/glcanvas/gtk/glcanvas_wrap.cpp:407: error: `wxGLCanvas' undeclared

Add BUILD_GLCANVAS=0 as described in BUILD.txt

Almost done, but now I get this:
....
byte-compiling /usr/lib/python2.3/site-packages/wxPython/windows.py to windows.pyc
running install_headers
Traceback (most recent call last):
File "setup.py", line 717, in ?
   cmdclass = { 'install_data': wx_smart_install_data,
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/core.py", line 149, in setup
   dist.run_commands()
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/dist.py", line 907, in run_commands
   self.run_command(cmd)
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/dist.py", line 927, in run_command
   cmd_obj.run()
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/command/install.py", line 505, in run
   self.run_command(cmd_name)
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/cmd.py", line 333, in run_command
   self.distribution.run_command(command)
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/distutils/dist.py", line 927, in run_command
   cmd_obj.run()
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/config.py", line 411, in run
   if WXPREFIX.startswith(root):
TypeError: expected a character buffer object

Make this change:

http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/wxPython/config.py.diff?r1=1.6&r2=1.7

Sorry still bothering you, Robin, but now when I try to import wx I get:

Python 2.3.3 (#2, Feb 24 2004, 09:29:20)
[GCC 3.3.3 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/wx/__init__.py", line 19, in ?
    from wx.core import *
  File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/wx/core.py", line 4, in ?
    import _core
ImportError: No module named _core

I have installed like this:
python setup.py install WX_CONFIG=/opt/wx/2.5/bin/wx-config WXPORT=gtk2 UNICODE=1 BUILD_GLCANVAS=0

no errors. Thanks
p.

Petr Šimon wrote:

Sorry still bothering you, Robin, but now when I try to import wx I get:

Python 2.3.3 (#2, Feb 24 2004, 09:29:20)
[GCC 3.3.3 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/wx/__init__.py", line 19, in ?
   from wx.core import *
File "/home/simu/progs/wxPythonSrc-2.5.1.5/wxPython/wx/core.py", line 4, in ?
   import _core
ImportError: No module named _core

I have installed like this:
python setup.py install WX_CONFIG=/opt/wx/2.5/bin/wx-config WXPORT=gtk2 UNICODE=1 BUILD_GLCANVAS=0

Since you did an install wxPython will have been installed to Python's site-packages dir, but it appears you are importing wx from the tarball dir. Change to another dir and unset PYTHONPATH if you have it set.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thank you Robin. And sorry for being little ignorant :wink:
Petr