Solved

wxPython build:  "parse error before" during Python setup

Posted on 2004-10-12
5
342 Views
Last Modified: 2013-12-27
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
0
Comment
Question by:Mike R.
  • 3
  • 2
5 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 12295347
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.

0
 
LVL 38

Expert Comment

by:yuzh
ID: 12295522
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
0
 
LVL 3

Author Comment

by:Mike R.
ID: 12300095
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
0
 
LVL 38

Accepted Solution

by:
yuzh earned 500 total points
ID: 12305357
wxGtk = wxWindows with GTK+, requires the GTK+ library to be installed on your system.

See "wxWindows 2.5 for GTK installation":
http://programming.ccp14.ac.uk/ftp-mirror/programming/wxwindows/pub/2.5.0p1/install-gtk-2.5.0.txt

Download:
http://www.wxwindows.org/
0
 
LVL 3

Author Comment

by:Mike R.
ID: 12309988
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now