Am 24.11.2015 um 13:12 schrieb Airton Granero:
> I tried to compile wxPython using Python35 and VS2015.
Unfortunately you tried a bit too early. I wanted to post a summary this
week.
It took me some time last week to build Phoenix for Python 3.5 in 32 and
64 bit.
distutils.msvc9compiler is still the right version.
I hope I did not forget anything relevant in the instructions below. The
rest of the week I'm probably not online too often, but I will try to
support you.
I did use a more recent version of sip, but I would assume that the
standard version is still OK.
I did only do a basic verification, as my main version is still Python
3.4 32 bit.
==================================
Prerequisites:
- Python 2.7 installed for the build script
- Cygwin installed
- Visual Studio 2015 Community Edition installed; my Express edition
had only 32 bit compilers
The vcvarsall.bat should be at "C:\Program Files (x86)\Microsoft
Visual Studio 14.0\VC\vcvarsall.bat"
The path "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin"
should exist and cl.exe should be there.
Additional prerequisites for 64 bit:
- Check for 64 compiler:
The path "C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\amd64" should exist and cl.exe should be there
If not try: New Project -> Templates -> Visual C++ -> MFC ->
Install Microsoft Foundation Classes for C++
- wxPython Phoenix downloaded from git and git submodule initialized.
The commands should probably be:
git submodule init
git submodule update
The downloaded version of wxWidgets is not the most recent one.
==================================
Required modifications:
The Visual Studio 2015 compiler, aka version 14 is not known to older
versions of wxWidgets and to wxPython.
wxWidgets: apply these patches:
http://trac.wxwidgets.org/attachment/ticket/16854/msw_vc14_compiler_fixes.diff
wxPython:
Add compiler version 14 to these two scripts:
Phoenix\ext\wxWidgets\build\tools\build-wxwidgets.py
Phoenix\buildtools\config.py
def getVisCVersion():
text = getoutput("cl.exe")
if 'Version 13' in text:
return '71'
if 'Version 15' in text:
return '90'
if 'Version 16' in text:
return '100'
if 'Version 19' in text:
return '140'
# TODO: Add more tests to get the other versions...
else:
return 'FIXME'
Modify Phoenix/wscript configure function to get the compiler version
number from distutily.msvc9compiler:
(I have verified this modification only with Python 3.4. and 3.5.)
def configure(conf):
if isWindows:
# For now simply choose the compiler version based on the Python
# version. We have a chicken-egg problem here. The compiler
needs to
# be selected before the Python stuff can be configured, but we
need
# Python to know what version of the compiler to use.
# TODO: Fix this
import distutils.msvc9compiler
msvc_version = str( distutils.msvc9compiler.get_build_version() )
#msvc_version = '9.0' #conf.options.msvc_ver
#if conf.options.python and ('33' in conf.options.python or
#'34' in conf.options.python or
#'35' in conf.options.python):
#msvc_version = '10.0'
conf.env['MSVC_VERSIONS'] = ['msvc ' + msvc_version]
conf.env['MSVC_TARGETS'] = [conf.options.msvc_arch]
conf.load('msvc')
Check whether the doxygen shell script has the correct line endings for
Cygwins bash shell (LF only, not CR+LF):
Phoenix\ext\wxWidgets\docs\doxygen\regen.sh
If you run into encoding problems, you may also want to change
Phoenix/buildtools/config.py:
In runcmd(...) add an 'ignore':
output = output.decode('utf-8', 'ignore') # TODO: is utf-8 okay here?
==================================
Optional modifications:
In the older wx version is a bug which prevents multiple blocks to be
selected in the grid.
This patch fixes the problem:
https://github.com/wxWidgets/wxWidgets/commit/6c20d775c4fd77dfd7fb0e7e679ab8149760413a
==================================
Build:
Open a cmd window (not Cygwin!)
Go to the Phoenix path.
Enter command (Footnote 1):
chcp 1252
For building (without installation) the command is as follows:
D:/Python/Python27/python.exe build.py dox etg --nodoc sip build
--python=D:/Python/Python35/python.exe
(Of course you need to set your paths accordingly. Python 2.7 is
required for the build script, the other version is the target.)
When the build is finished, you should see a message like this:
------------ BUILD FINISHED ------------
To use wxPython from the build folder (without installing):
- Set your PYTHONPATH variable to D:\Python\Sources34\Phoenix.
You may do as suggested or call the build script again with the install
command.
==================================
Footnotes:
(1)
Otherwise the waf build engine may have problems with Visual C compilers
outputting non-ASCII characters, which can e.g. happen with non-english
installations.
You would just get the error message "msvc: Impossible to find a valid
architecture for building (in setup_msvc)", unless you apply the patch
at
https://github.com/waf-project/waf/commit/0e03aec82dfabefc9d104104fb0c18916a8db74b
.
If you apply the patch, the build would still fail, but at least you
would get a more meaningful error message.
Regards,
Dietmar