Documentation/Labs/CMake-ified Python/2.7.3-VS2008-02042013

From Slicer Wiki
Jump to: navigation, search
Home < Documentation < Labs < CMake-ified Python < 2.7.3-VS2008-02042013

Configure

No configure errors, but many options disabled due to missing libraries.

Build

First build

1>------ Build started: Project: libpython-static, Configuration: Debug x64 ------
2>------ Build started: Project: pgen, Configuration: Debug x64 ------
2>Compiling...
1>Compiling...
2>cl : Command line error D8021 : invalid numeric argument '/Wstrict-prototypes'
2>Build log was saved at "file://c:\pieper\CMakePython\cpython-2.7.3-build\cmake\pgen\pgen.dir\Debug\BuildLog.htm"
2>pgen - 1 error(s), 0 warning(s)
1>cl : Command line error D8021 : invalid numeric argument '/Wstrict-prototypes'
1>Build log was saved at "file://c:\pieper\CMakePython\cpython-2.7.3-build\cmake\libpython\libpython-static.dir\Debug\BuildLog.htm"
1>libpython-static - 1 error(s), 0 warning(s)
3>------ Build started: Project: python, Configuration: Debug x64 ------
3>Compiling...
3>cl : Command line error D8021 : invalid numeric argument '/Wstrict-prototypes'
3>Build log was saved at "file://c:\pieper\CMakePython\cpython-2.7.3-build\cmake\python\python.dir\Debug\BuildLog.htm"
3>python - 1 error(s), 0 warning(s)
4>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
4>Project not selected to build for this solution configuration 
========== Build: 0 succeeded, 3 failed, 2 up-to-date, 1 skipped ==========

Second Build

moved "strict-prototypes" flag to non-windows only.

Thousands of warnings, then:

3>Compiling manifest to resources...
3>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
3>Copyright (C) Microsoft Corporation.  All rights reserved.
3>Linking...
3>LINK : fatal error LNK1104: cannot open file 'dl.lib'
3>Build log was saved at "file://c:\pieper\CMakePython\cpython-2.7.3-build\cmake\python\python.dir\Debug\BuildLog.htm"
3>python - 1 error(s), 48 warning(s)
4>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
4>Project not selected to build for this solution configuration 
========== Build: 2 succeeded, 1 failed, 2 up-to-date, 1 skipped ==========

Third build

manually removed dl.lib and m.lib from link line in visual studio properties.

Then made corresponding change to cmake/libpython/CMakeLists.txt

   if(NOT WIN32)
     target_link_libraries(${name} dl m)
   endif(NOT WIN32)

Now get this link error:

1>------ Build started: Project: python, Configuration: Debug x64 ------
1>Linking...
1>python2.7.lib(dynload_win.obj) : error LNK2019: unresolved external symbol _Py_DeactivateActCtx referenced in function _PyImport_GetDynLoadFunc
1>python2.7.lib(dynload_win.obj) : error LNK2019: unresolved external symbol _Py_ActivateActCtx referenced in function _PyImport_GetDynLoadFunc
1>C:\pieper\CMakePython\cpython-2.7.3-build\cmake\python\Debug\python.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\pieper\CMakePython\cpython-2.7.3-build\cmake\python\python.dir\Debug\BuildLog.htm"
1>python - 3 error(s), 0 warning(s)
2>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
2>Project not selected to build for this solution configuration 
========== Build: 0 succeeded, 1 failed, 4 up-to-date, 1 skipped ==========

Fourth build

Found that this patch (ifdef for static build) had not been applied during the build process:

./cmake/patches-win32/01-dynload_win.patch

Now compile completes and python can be run.

Exits with error code 0x1.

Perhaps other patches have not been applied either.

Fifth build

Found that exit was happening during initsite call (pyrun.c line 266). Commenting that out allows python to run, and get to the >>> prompt, but nothing works.

Python 2.7.3 (default, Feb  4 2013, 08:29:31) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>>

LookupError: no codec search functions registered: can't find encoding
[10885 refs]
>>>

LookupError: no codec search functions registered: can't find encoding
[10885 refs]
>>> import sys

LookupError: no codec search functions registered: can't find encoding
[10885 refs]
>>>


Stopping until we make a proper git repository for tracking these edits.