OGRECave / ogre

scene-oriented, flexible 3D engine (C++, Python, C#, Java)
https://ogrecave.github.io/ogre/
MIT License
3.99k stars 980 forks source link

Python SWIG build errors (MSVC2017/Python 3.7/SWIG 3.0.12) #1023

Closed robbmcleod closed 5 years ago

robbmcleod commented 5 years ago

System Information

Detailed description

On configuring with CMake I do get some warnings:

CMake Deprecation Warning at C:/Program Files/CMake/share/cmake-3.13/Modules/UseSWIG.cmake:524 (message):
SWIG_ADD_MODULE is deprecated.  Use SWIG_ADD_LIBRARY instead.
Call Stack (most recent call first):
Components/Python/CMakeLists.txt:36 (swig_add_module)

CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.13/Modules/UseSWIG.cmake:564 (message):
Policy CMP0078 is not set.  Run "cmake --help-policy CMP0078" for policy
details.  Use the cmake_policy command to set the policy and suppress this
warning.
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.13/Modules/UseSWIG.cmake:525 (swig_add_library)
Components/Python/CMakeLists.txt:36 (swig_add_module)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at C:/Program Files/CMake/share/cmake-3.13/Modules/UseSWIG.cmake:524 (message):
SWIG_ADD_MODULE is deprecated.  Use SWIG_ADD_LIBRARY instead.
Call Stack (most recent call first):
Components/Python/CMakeLists.txt:45 (swig_add_module)

Which is then repeated 4 times. Then when building:

Severity    Code    Description Project File    Line    Suppression State
Error   C2668   'Ogre::TextureManager::createOrRetrieve': ambiguous call to overloaded function _Ogre   C:\Sync\soft\ogre\build64\Components\Python\CMakeFiles\_Ogre.dir\OgrePYTHON_wrap.cxx    208543  
Error   C2668   'Ogre::TextureManager::createOrRetrieve': ambiguous call to overloaded function _Ogre   C:\Sync\soft\ogre\build64\Components\Python\CMakeFiles\_Ogre.dir\OgrePYTHON_wrap.cxx    209598  
Error   C2668   'Ogre::GpuProgramManager::getResourceByName': ambiguous call to overloaded function _Ogre   C:\Sync\soft\ogre\build64\Components\Python\CMakeFiles\_Ogre.dir\OgrePYTHON_wrap.cxx    218809  
Error   C2668   'Ogre::GpuProgramManager::getResourceByName': ambiguous call to overloaded function _Ogre   C:\Sync\soft\ogre\build64\Components\Python\CMakeFiles\_Ogre.dir\OgrePYTHON_wrap.cxx    218860  
Error   C2668   'Ogre::MeshManager::createOrRetrieve': ambiguous call to overloaded function    _Ogre   C:\Sync\soft\ogre\build64\Components\Python\CMakeFiles\_Ogre.dir\OgrePYTHON_wrap.cxx    399839  
Error   C2668   'Ogre::MeshManager::createOrRetrieve': ambiguous call to overloaded function    _Ogre   C:\Sync\soft\ogre\build64\Components\Python\CMakeFiles\_Ogre.dir\OgrePYTHON_wrap.cxx    400611  
Error   LNK2019 unresolved external symbol _Py_NotImplementedStruct referenced in function SwigPyBuiltin__Ogre__Font_richcompare    _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyBool_Type referenced in function _wrap_Font_setAntialiasColour _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyFloat_Type referenced in function "int __cdecl SWIG_AsVal_float(struct _object *,float *)" (?SWIG_AsVal_float@@YAHPEAU_object@@PEAM@Z) _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_OverflowError referenced in function _wrap_OverlayManager_getScriptPatterns    _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_RuntimeError referenced in function "void __cdecl SWIG_Python_AddErrorMsg(char const *)" (?SWIG_Python_AddErrorMsg@@YAXPEBD@Z) _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_NotImplementedError referenced in function _wrap_Font_getMaterial  _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_TypeError referenced in function SwigPyObject_append   _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyType_Type referenced in function PyInit__OgreOverlay   _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol _PyWeakref_ProxyType referenced in function SWIG_Python_GetSwigThis  _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol _PyWeakref_CallableProxyType referenced in function SWIG_Python_GetSwigThis  _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_AttributeError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)   _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_IndexError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)   _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_MemoryError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_SyntaxError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_SystemError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_ValueError referenced in function _wrap_OverlayContainer_removeChild   _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_ZeroDivisionError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)    _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK2019 unresolved external symbol PyExc_IOError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreOverlay    C:\Sync\soft\ogre\build64\Components\Python\OgreOverlayPYTHON_wrap.obj  1   
Error   LNK1120 18 unresolved externals _OgreOverlay    C:\Sync\soft\ogre\build64\lib\Release\_OgreOverlay.pyd  1   
Error   LNK2019 unresolved external symbol _Py_NotImplementedStruct referenced in function SwigPyBuiltin__OgreBites__KeyboardEvent_richcompare  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyFloat_Type referenced in function "int __cdecl SWIG_AsVal_float(struct _object *,float *)" (?SWIG_AsVal_float@@YAHPEAU_object@@PEAM@Z) _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_OverflowError referenced in function "struct _object * __cdecl swig::from<class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > >(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &)" (??$from@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@swig@@YAPEAU_object@@AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z)  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_RuntimeError referenced in function "public: __cdecl Swig::DirectorMethodException::DirectorMethodException(char const *)" (??0DirectorMethodException@Swig@@QEAA@PEBD@Z)  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_NotImplementedError referenced in function _wrap_ApplicationContext_removeInputListener    _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_TypeError referenced in function _wrap_ProgressBar_getComment  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyType_Type referenced in function PyInit__OgreBites _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyBool_Type referenced in function _wrap_CameraMan_setFixedYaw   _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol _PyWeakref_ProxyType referenced in function SWIG_Python_GetSwigThis  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol _PyWeakref_CallableProxyType referenced in function SWIG_Python_GetSwigThis  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_AttributeError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)   _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_IndexError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)   _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_MemoryError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_SyntaxError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_SystemError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_ValueError referenced in function _wrap_ProgressBar_setCaption _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_ZeroDivisionError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)    _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK2019 unresolved external symbol PyExc_IOError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreBites  C:\Sync\soft\ogre\build64\Components\Python\OgreBitesPYTHON_wrap.obj    1   
Error   LNK1120 18 unresolved externals _OgreBites  C:\Sync\soft\ogre\build64\lib\Release\_OgreBites.pyd    1   
Error   MSB6006 "cmd.exe" exited with code 1.   libOgre C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets   209 
Error   LNK2019 unresolved external symbol _Py_NotImplementedStruct referenced in function SwigPyBuiltin__Ogre__RTShader__SGScriptTranslator_richcompare    _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyBool_Type referenced in function _wrap_RenderState_setLightCountAutoUpdate _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyFloat_Type referenced in function "int __cdecl SWIG_AsVal_float(struct _object *,float *)" (?SWIG_AsVal_float@@YAHPEAU_object@@PEAM@Z) _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_OverflowError referenced in function _wrap_ShaderGenerator_getShaderProfilesList   _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_NotImplementedError referenced in function _wrap_HardwareSkinningFactory_prepareEntityForSkinning  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_TypeError referenced in function _wrap_ShaderGenerator_getCreateShaderOverProgrammablePass _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyType_Type referenced in function PyInit__OgreRTShader  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol _PyWeakref_ProxyType referenced in function SWIG_Python_GetSwigThis  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol _PyWeakref_CallableProxyType referenced in function SWIG_Python_GetSwigThis  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_AttributeError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)   _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_IndexError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)   _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_MemoryError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_RuntimeError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z) _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_SyntaxError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_SystemError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_ValueError referenced in function _wrap___lshift__ _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_ZeroDivisionError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)    _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK2019 unresolved external symbol PyExc_IOError referenced in function "struct _object * __cdecl SWIG_Python_ErrorType(int)" (?SWIG_Python_ErrorType@@YAPEAU_object@@H@Z)  _OgreRTShader   C:\Sync\soft\ogre\build64\Components\Python\OgreRTShaderPYTHON_wrap.obj 1   
Error   LNK1120 18 unresolved externals _OgreRTShader   C:\Sync\soft\ogre\build64\lib\Release\_OgreRTShader.pyd 1   

I thought the unresolved external symbols could be due to the include/library paths not being correct, but when updating the include and lib paths to C:\Anaconda3\envs\env_fd\include and C:\Anaconda3\envs\env_fd\lib and C:\Anaconda3\envs\env_fd\libs respectively I still get the same errors. And CMake definitely finds these directories without trouble.

I also get a bunch of these warnings:

 Warning    C4101   'e': unreferenced local variable    _Ogre   C:\Temp\ogre-1.11.5\build64\Components\Python\CMakeFiles\_Ogre.dir\OgrePYTHON_wrap.cxx  21016   

I also looked at your appveyor.yml but apparently the CI service doesn't build the Python bindings, so no insight there. I also tried the 1.11.5 stable release source but ran into the same trouble.

Ogre.log

Not applicable.

paroj commented 5 years ago

referencing PR should get you going. Also see https://forums.ogre3d.org/viewtopic.php?f=11&t=94696&p=543783#p543783

robbmcleod commented 5 years ago

Thanks for the quick response. Now getting an Access violation when building libOgre for C# on the file Bites/include/OgreBites.i. I thought it might be a Windows issue so I did a reboot but hit the same error.

Here's the excerpt from the build log:

1>Swig compile ../Bites/include/OgreBites.i for csharp
1>Access violation
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code 1.
1>Done building project "libOgre.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========

If I turn off the CSharp target in CMake, it builds without trouble and I have the assorted .py and .pyd files.

On the ogre-meshviewer, it looks like a useful sample code, but it has some trouble loading the Zip files:

Creating resource group OgreMeshViewer
Traceback (most recent call last):
  File "ogre_mesh_viewer.py", line 357, in <module>
    app.initApp()
  File "ogre_mesh_viewer.py", line 279, in setup
    OgreBites.ApplicationContext.setup(self)
  File "ogre_mesh_viewer.py", line 264, in locateResources
    rgm.addResourceLocation(trays_loc, "Zip", RGN_MESHVIEWER)
RuntimeError: Ogre::InternalErrorException::InternalErrorException: 
C:/workspace/ogre/build/sdk/Media/packs/SdkTrays.zip - error whilst opening archive: Unable to read 
zip file. in ZipArchive::checkZzipError at c:\workspace\ogre\ogremain\src\ogrezip.cpp (line 416)

Unzipping manually didn't work as a workaround.

paroj commented 5 years ago

Now getting an Access violation when building libOgre for C#

you probably have to add /bigobj there as well. Note that the C# component is quite fresh: https://www.ogre3d.org/2018/12/20/ogre-1-11-final-release

but it has some trouble loading the Zip files:

I have seen this error on our VS2013 builds, but could not yet reproduce it locally.

Unzipping manually didn't work as a workaround.

you will also have to change the resources.cfg accordingly

robbmcleod commented 5 years ago

you will also have to change the resources.cfg accordingly

Ok, thanks, I'll take a look.