Link to home
Start Free TrialLog in
Avatar of Mike R.
Mike R.

asked on

wxPython build: "parse error before" during Python setup

Hey Guys,

I am in the process of installing wxPython on Solaris 9.  I was able to do a good configure and a successful make...however, the last step is to run a python setup, to integrate the wxPython tools with the Python install.  This is where I am having difficulty.  Here are the steps so far...

#PREFIXDIR=/opt/sfw/lib/python2.2/site-packages/wxWidgets

#./configure --prefix=$PREFIXDIR \
             --with-gtk \
             --enable-debug_flag \
             --enable-geometry \
             --enable-sound --with-sdl \
             --enable-display \
             --enable-optimize \
             --enable-rpath=$PREFIXDIR/lib \
             --enable-permissive \
             --disable-gtk2

...resulted in the output of ...

Configured wxWindows 2.5.1 for `sparc-sun-solaris2.9'

  Which GUI toolkit should wxWindows use?                 gtk
  Should wxWindows be compiled into single library?       no
  Should wxWindows be compiled in debug mode?             no
  Should wxWindows be linked as a shared library?         yes
  Should wxWindows be compiled in Unicode mode?           no
  What level of wxWindows compatibility should be enabled?
                                       wxWindows 2.2      no
                                       wxWindows 2.4      yes
  Which libraries should wxWindows use?
                                       jpeg               builtin
                                       png                builtin
                                       regex              sys
                                       tiff               builtin
                                       zlib               builtin
                                       odbc               no
                                       expat              builtin
                                       libmspack          no
                                       sdl                yes
... I then ran the following "make" script ...

make $* \
    && make -C contrib/src/gizmos $* \
    && make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" $* \
    && make -C contrib/src/stc $* \
    && make -C contrib/src/xrc $*
 
...with apparently successful output ...

HOWEVER, the final command to integrate Python with wxPython is giving the following problems (output truncated to last few lines...)

#python2.3 setup.py BUILD_GLCANVAS=0 BUILD_OGL=0 BUILD_STC=0
.
.
.
   _wrap_Display_ChangeMode(PyObject*, PyObject*, PyObject*)':
src/gtk/misc_wrap.cpp:27947: parse error before `)' token
src/gtk/misc_wrap.cpp: In function `PyObject*
   _wrap_Display_ResetMode(PyObject*, PyObject*, PyObject*)':
src/gtk/misc_wrap.cpp:27987: parse error before `)' token
error: command '/opt/sfw/gcc-3.2/bin/gcc' failed with exit status 1

Any suggesstions!?
Thanks!
M
Avatar of yuzh
yuzh

I think it is easy to just download the binary package from:
http://sunfreeware.com/

Now get back to your problem, it could be the problem with your gcc complier, or some
of the lib path (LD_LIBRARY_PATH) missing.

The last time I built python was 2 years+ ago. I used gcc2.95.x (I have trouble with gcc3.0.x
for building mysql/php etc).  I have not use gcc-3.2.x, don't know how good it is. I have used
gcc 3.3.2 to built a webserver early this year, not much trouble.

You might want to check the Makefile (created by configure) to make sure things are ok,
eg Link flags etc. I normaly use gcc + glib + libgcc +zlib + autoconfig (GNU), not sure
if you have all of them installed in your system.

Hi rightmirem,

"SOLARIS NOTE: The --enable-rpath option may cause problems when using wxGTK on Solaris when compiling wxPython as described below. The woraround is to not use --enable-rpath flag for configure, but in that case all wxPython applications must have the LD_LIBRARY_PATH set to include $WXPREF/lib, or you can use the 'crle' program to modify the runtime linking environment. If this is the only installation of wxGTK on the system then you can use a system library path for prefix and not have to worry about it at all"

see : http://www.wxpython.org/INSTALL.html
Avatar of Mike R.

ASKER

Hey Yuzh,

Thanks again for all the help.  I actually tried configuring both with and without the enable-rpath (was thinking the same thing) and still ended up with the same errors.  I also tried the "disable-gtk2" flag just in case, but to no avail.

As an aside...I went to sunfreeware and was able to find the Pythin binary...but no the wxPython binaries.  I am wondering if I just looked in the wrong spot.  You don't happen to have the full link do you?  Or is the wx stuff included in the main Python install from that download?

I THINK all the pathiong and links are correct in the make file.  I am using gcc, g++, but I am not sure regarding the details of their installation as I inherited this system.

As far as adding items to the path...the configure is only identifying gtk1.2 as being on the system...and I am not sure if there is a difference between gtk1.2 and wxGtk.  What should I be looking for reagrding GTK installations (files with a find...for example?)

Thanks!
m
ASKER CERTIFIED SOLUTION
Avatar of yuzh
yuzh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike R.

ASKER

Hey Yuzh,

We do have GTK1.2.3 installed...but I discovered it was a different issue.

Simply put, the installation of wxPython runs TWO "makes".  First you run a standard configure, and a standard make/make install.  This compiles and creates all the necessary files and libs...just like every other install on the face of the (UNIX) earth.

HOWEVER...once the wxPython files are created...you then have to run the "python3.2 setup.py install" command to install these files INTO the existing Python install.  Seems simple enough...

The PROBLEM was that...when compiling I was using the "--prefix=<wherever>" switch to try and install the libs into a preferred sub directory...which was a DIFFERENT sub-dir than where Python3.2 was installed.  The standard (first) configure/make worked fine...BUT when running the "setup.py" stuff, Python was attempting to "install" these files where IT wanted them (in its own lib) and the contradiction between where I told the config/make to install them, and where Python wanted to install them, was causing the error.

Once I set the "--prefix=<existing python install>" during the configuration and make, everything functioned fine.  So we are good to go.  You still get points for the efforts though :-)

And may i say I hope I never have to deal with Python again (well, at least for another couple of weeks...at least :-)
M