[wxPython-users] Building Under Cygwin
Harry Goldschmitt
harry at hgac.com
Wed Jan 2 14:07:03 PST 2008
At 3:51 PM -0800 12/31/07, Robin Dunn wrote:
>Harry Goldschmitt wrote:
>>At 10:28 AM -0800 12/27/07, Robin Dunn wrote:
>>>Harry Goldschmitt wrote:
>>>
>>>>A buddy of mine pointed out that your instructions might be for
>>>>compiling a wxPython that lives and in the Windows environment,
>>>>not the Cygwin environment.
>>>
>>>Yes, the directions on the web site assume python.org's Python and
>>>mingw32, see the bottom section of
>>>http://wxpython.org/builddoc.php. I don't think that it should
>>>take much work to make it work with cygwin's Python, the details
>>>just need to be worked out and tweaks made to setup.py.
>>>
>>>>In that case there would be no interaction with the Python that
>>>>is installed in the Cygwin side, and the os.name would be
>>>>"Windows_NT". I tried forcing the python command to the one on
>>>>Windows and got other problems.
>>>
>>>What problems?
>>
>>I was trying to get wxwidgets and wxPython to compile under Cygwin.
>>While trying to download the cairo source, I managed to totally
>>mess up my Cygwin. While recovering from that, I reinstalled all
>>of Cygwin, including the normally skipped packages and the cairo
>>source. That took most of yesterday.
>>
>>Next, if I let wxwidgets default to using GTK, I ran into a missing
>>function gdk_cairo_create defined in header, gdkcairo.h, on my
>>Linux box. I couldn't easily find a source package for GTK that
>>installs on Cygwin. So I tried specifying several flavors of the
>>configure options. This one worked:
>>
>>cd $WXDIR
>>mkdir bld
>>cd bld
>>
>>CC="gcc -mcygwin -mwindows" \
>>CXX="g++ -mcygwin -mwindows" \
>>LDFLAGS="-mcygwin -mwindows" \
>>../configure \
>> --with-msw \
>> --build=i686-pc-cygwin \
>> --prefix=/opt/wx/2.8 \
>> --disable-unicode \
>> --enable-debug \
>> --enable-debug_gdb \
>> --enable-geometry \
>> --enable-display \
>> --enable-shared \
>> --disable-stl \
>> --with-expat=builtin \
>> --with-zlib=builtin
>>
>>I had to disable STL, due to the wstring problem, I previously ran
>>into and I had to disable unicode for a similar problem. I had to
>>turn off builtin regex, because it kept trying for a unicode build
>>and couldn't find one. At any rate this worked for wxwidgets.h
>>
>>Next I tried the setup.py. I forced WXPORT to msw in config.py.
>>The result was:
>>
>>$ python setup.py BUILD_GLCANVAS=0 BUILD_ACTIVEX=0
>>WX_CONFIG="bash.exe -e /opt/w
>>x/2.8/bin/wx-config" build_ext --inplace
>>WARNING: WXWIN not set in environment. Assuming '..'
>>Preparing CORE...
>>Preparing STC...
>>Preparing GIZMOS...
>>running build_ext
>>Warning: Can't read registry to find the necessary compiler setting
>>Make sure that Python modules _winreg, win32api or win32con are installed.
>>building '_core_' extension
>>error: Python was built with Visual Studio version 6, and
>>extensions need to be
>>built with the same version of the compiler, but it isn't installed.
>
>You need to tell distutils to use the gcc compiler instead of the MS
>compiler. Try adding --compiler=cygwin or --compiler=mingw32
Thanks for all your help.
I changed the command line for the wxPython distutils to:
python setup.py COMPILER=cygwin BUILD_GLCANVAS=0 BUILD_ACTIVEX=0
WX_CONFIG="bash.exe -e /opt/wx/2.8/bin/wx-config" build_ext --inplace
I got everything to work after a bit of fiddling.
The first failure was compiling stc_wrap.cpp, because wx/stc/stc.h
couldn't be found. So I created an stc directory under
/opt/wx/2.8/include/wx-2.8/wx, copied stc.h from contrib/src/stc to
it. stc_wrap.cpp compiled successfully, but the ld step failed
because the wx_mswd_stc-2.8 library couldn't be found. I copied it
to /opt/wx/2.8/lib.
Next, I had similar problems with the gizmos directory. I copied all
the header files from the gizmos directory to a new
/opt/wx/2.8/include/wx-2.8/wx/gizmos directory. I also had to copy
the dll.a for it to /opt/wx/2.8/lib.
Do you have a test suite I can run? I've run a couple of the demo.py
demos, but haven't done an exhaustive check.
Harry
More information about the wxpython-users
mailing list