[Paraview] build ParaView git on Windows7 64bit + MSVC2010 with vtkPythonCore errors

David Partyka david.partyka at kitware.com
Wed Feb 16 10:42:29 EST 2011


Hi Xunlei, we just checked in a change into paraview/vtk that should fix
this. As you noticed python forces a header link to python27_d.lib when
building debug. To get around this (because most python packages for windows
don't come with debug python libraries), we undefine _DEBUG, include
python.h and then restore _DEBUG.

The problem with this is that any system level headers included from
python.h were also effectively included in 'release' mode when we undefined
_DEBUG. To work around this we determined the set of headers that python
includes and include them before undefining _DEBUG. This seems to address
the linking issues. Please give it a try and let us know if you experience
any other issues.

http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=6e345f29bdeafd5fa7c7779cb0aa4e87fe5a8360

Thanks!

On Wed, Feb 16, 2011 at 8:05 AM, Xunlei Wu <xunlei at renci.org> wrote:

> Hi David and Rob,
> Just want to add another data point.
>
> I have rebuild ParaView from git source with MSVC2008 instead. Everything
> else is the same with what I was reporting before. Enthought Python 7.0.1
> 64bit is used. All the python flags in Cmake are turned on.
> PYTHON_DEBUG_LIBRARY is left empty accompanied with modified
> C:/Python27/include/pyconfig.h as following, i.e. assigning python27.lib as
> the debug library instead of default python27_d.lib.
>
>
>
>                 /* For an MSVC DLL, we can nominate the .lib files used by
> extensions */
>
> #ifdef MS_COREDLL
>
> #             ifndef Py_BUILD_CORE /* not building the core - must be an
> ext */
>
> #                             if defined(_MSC_VER)
>
>                                                 /* So MSVC users need not
> specify the .lib file in
>
>                                                 their Makefile (other
> compilers are generally
>
>                                                 taken care of by
> distutils.) */
>
> #                                             ifdef _DEBUG
>
> #                                                             pragma
> comment(lib,"python27.lib")//"python27_d.lib")
>
> #                                             else
>
> #                                                             pragma
> comment(lib,"python27.lib")
>
> #                                             endif /* _DEBUG */
>
> #                             endif /* _MSC_VER */
>
> #             endif /* Py_BUILD_CORE */
>
> #endif /* MS_COREDLL */
>
>
>
> The entire build went smoothly. And now I have a running (Debug) paraview
> package! Another interesting thing to be noted is with
> “VTK_WRAP_PYTHON_SIP”. When it is enabled, CMake looks for sip installation
> in the system. However, current SIP source distribution for windows
>
> http://www.riverbankcomputing.co.uk/software/sip/download
>
> does not have 64bit windows specs. There is only win32-msvc2008 variation
> as the closest match. That creates a 32bit installation instead. And
> vtkCommonPythonSIP(D) projects cannot be built due to incompatible
> libraries…
>
>
>
> Best,
>
> x
>
>
>
> *From:* paraview-bounces at paraview.org [mailto:
> paraview-bounces at paraview.org] *On Behalf Of *Xunlei Wu
> *Sent:* Tuesday, February 15, 2011 5:05 PM
>
> *To:* David Partyka
> *Cc:* paraview at paraview.org
> *Subject:* Re: [Paraview] build ParaView git on Windows7 64bit + MSVC2010
> with vtkPythonCore errors
>
>
>
> Hi Dave and All,
>
> I got some progress in terms of building vtkPythonCore. I had Enthought’s
> Python distribution ver 7.0.1 !!!64bit!!! initially. I have verified it is
> indeed a 64bit Python executable. The package comes with python27.lib and
> CMake did not blink and automatically set PYTHON_LIBRARY to that lib.
> However, during building, MSVC2010 kept reporting “python27.lib” cannot be
> found.
>
> Now, the fun part, I uninstalled Enthought distribution and tried “Python
> 2.7.1 Windows X86-64 Installer” from
>
> http://www.python.org/getit/
>
> This time, MSVC2010 no longer complained about missing “python27.lib”. I am
> left with errors like
>
>
>
> Error    1          error LNK2001: unresolved external symbol
> __imp__invalid_parameter_noinfo_noreturn
> C:\ParaViewGit_VS2010\VTK\Wrapping\Python\vtkPythonUtil.obj
> vtkPythonCore
>
>
>
> After a bit digging, the error has something to do std::vector. Here are
> the beginning lines of vtkPythonUtil.cxx
>
>
>
> #include "vtkPythonUtil.h"
>
> #include "vtkPythonOverload.h"
>
>
>
> #include "vtkSystemIncludes.h"
>
>
>
> #include "vtkObject.h"
>
> #include "vtkSmartPointerBase.h"
>
> #include "vtkWeakPointerBase.h"
>
> #include "vtkVariant.h"
>
> #include "vtkStdString.h"
>
> #include "vtkUnicodeString.h"
>
> #include "vtkWindows.h"
>
> #include "vtkToolkits.h"
>
>
>
> #include <vtksys/ios/sstream>
>
> #include <vtkstd/map>
>
> #include <vtkstd/vector>
>
> #include <vtkstd/string>
>
> #include <vtkstd/utility>
>
>        ...
>
>
>
> After I move “#include <vtkstd/vector>” to the top of the file, POW!
> vtkPythonCore is successfully built. So I guess #include <vector> in
> vtkstd/vector.h gets undefined somewhere by those headers listed before it.
> Not sure whether it is a bug for other people.
>
>
>
> x
>
>
>
>
>
>
>
> *From:* paraview-bounces at paraview.org [mailto:
> paraview-bounces at paraview.org] *On Behalf Of *Xunlei Wu
> *Sent:* Sunday, February 13, 2011 7:31 PM
> *To:* David Partyka
> *Cc:* paraview at paraview.org
> *Subject:* Re: [Paraview] build ParaView git on Windows7 64bit + MSVC2010
> with vtkPythonCore errors
>
>
>
> Hi David,
>
> I am out of luck.
>
> Just did a fresh CMake configure with PARAVIEW_ENABLE_PYTHON on and the
> same PYTHON_LIBRARY value. The errors from MSVC2010. Any other suggestions?
>
> Best,
>
> x
>
>
>
> *From:* David Partyka [mailto:david.partyka at kitware.com]
> *Sent:* Sunday, February 13, 2011 4:33 PM
> *To:* Xunlei Wu
> *Cc:* paraview at paraview.org
> *Subject:* Re: [Paraview] build ParaView git on Windows7 64bit + MSVC2010
> with vtkPythonCore errors
>
>
>
> Hi Xunlei,
>
>
>
> What do you have the PYTHON_LIBRARY cmake option set to? If you set that
> correctly then it should be able to link properly. For example this is what
> it is set to on my machine.
>
>
>
> C:/Support/Python27-x32/libs/python27.lib
>
>
>
> On Sun, Feb 13, 2011 at 11:46 AM, Xunlei Wu <xunlei at renci.org> wrote:
>
> Hello,
>
> I am building Paraview from git source on a Windows7 64bit OS with
> MSVC2010. I have enabled
>
> PARAVIEW_ENABLE_PYTHON and VTKMY_WRAP_PYTHON in my CMake. I also built
> Python 2.7.1 64bit from source so that I have both python27.lib and
> python27_d.lib available. However the core python related projects are
> failed to build in both Debug and Release builds. Then the effects just
> trickled down like crazy. Below are 3 major errors in Debug build I feel
> might be the primary errors. And I do link python27_d.lib for all of them.
> Please see the attached CMakeLists.txt for more details.
>
>
>
> Error      6              error LNK1104: cannot open file
> 'python27.lib'
> C:\ParaViewGit\Utilities\VTKPythonWrapping\Executable\LINK
> vtkPVPythonInterpretor
>
> Error      5              error LNK1104: cannot open file 'python27.lib'
> C:\ParaViewGit\VTK\Wrapping\Python\LINK                vtkPythonCore
>
> Error      3              error LNK1104: cannot open file 'python27.lib'
> C:\ParaViewGit\VTK\Wrapping\LINK      vtkWrapPython
>
>
>
> Would you please help me? Thanks a lot.
>
>
>
> Best,
>
> x
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110216/6867592c/attachment-0001.htm>


More information about the ParaView mailing list