Solved

wxPython build:  "parse error before" during Python setup

Posted on 2004-10-12
5
341 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
Comment Utility
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
Comment Utility
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.
Comment Utility
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
Comment Utility
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.
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

762 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

7 Experts available now in Live!

Get 1:1 Help Now