Building Panda3D with MSVC 2015 and Python 3.5/3.6

Since it is a pain to install the Windows 7 SDK, we often get asked why we haven’t switched to MSVC 2015 already. The reason is that we still need to support Windows XP for a non-negligible number of Panda users, and MSVC 2010 is the latest compiler to support it. Given the sizeable market share of Windows XP, I think it would be unwise to drop support for it.

However, since Python 3.5 switched to MSVC 2015 and dropped Windows XP support, it might be a good idea to support both by using 2015 for the Python 3.5 builds, but still keep offering Python 2.7 and 3.4 builds compiled with MSVC 2010 for those who need to continue to support Windows XP.

So, building Panda with MSVC 2015 is now possible. You will need the latest GitHub clone of Panda3D, as well as these thirdparty packages, which include a copy of Python 3.5.3 and 3.6.1:
rdb.name/thirdparty-vc14-x64.7z (64-bit)
rdb.name/thirdparty-vc14.7z (32-bit)
You will also need to install the Windows 10 SDK.

Use this makepanda command to build it:

thirdparty\win-python3.5-x64\python.exe makepanda/makepanda.py --everything --msvc-version=14 --windows-sdk=10

(add --threads and --installer options as desired of course.)

The only package missing that’s worth mentioning is libRocket. It cannot be built since it does not support Python 3 at this point.

I’ve created a CMake script that will build all the thirdparty packages from source code. I’ve put it here:
github.com/rdb/panda3d-thirdparty
This can be used to easily rebuild the thirdparty packages for a different compiler, or using a different version. Feel free to contribute to the script to add missing packages.

Updated to include the remainder of the packages.

OpenEXR has been added. The Python build now also comes with pip, by user request.

Is there any chance that you could give some instructions on how to do this.
I have downloaded the thirdparty zip and the latest github panda, and haven’t a clue what to do.

I am using windows 10.

I was able to build most of the dependencies with the cmake script, except for openssl, which gives an error about not being able to find panda3d-thirdparty\openssl-ms.bat. Ring any bells?

@Asimov: all you need to do is extract the thirdparty directory into the Panda source directory, open a command prompt, change to the Panda source directory using “cd”, and type the command at the top of this thread in order to commence the build.

@cbrunner: Sorry, my bad, I guess I had forgotten to push that file. Fixed now.

Getting further in the build process, but now I’m seeing this:

(CustomBuild target) -> 
  c:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\contrib\open3dgc\o3dgcTimer.h(38): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory (compiling source file C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\code\glTFExporter.cpp) [C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp-build\code\assimp.vcxproj] [C:\repos\panda3d-thirdparty\build\assimp.vcxproj]
  c:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\contrib\open3dgc\o3dgcTimer.h(38): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory (compiling source file C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\code\glTFImporter.cpp) [C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp-build\code\assimp.vcxproj] [C:\repos\panda3d-thirdparty\build\assimp.vcxproj]
  c:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\contrib\open3dgc\o3dgcTimer.h(38): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory (compiling source file C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\code\glTFExporter.cpp) [C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp-build\code\assimp.vcxproj] [C:\repos\panda3d-thirdparty\build\assimp.vcxproj]
  c:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\contrib\open3dgc\o3dgcTimer.h(38): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory (compiling source file C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp\code\glTFImporter.cpp) [C:\repos\panda3d-thirdparty\build\assimp-prefix\src\assimp-build\code\assimp.vcxproj] [C:\repos\panda3d-thirdparty\build\assimp.vcxproj]

Looks to be an issue in the Assimp project. The relevant header expects WIN32 to be defined instead of _WIN32. If you don’t need assimp you can comment out the relevant part in the CMake file. I’ll talk to the Assimp people about getting this fixed.

Upstream merged my fix, and it should be good now.

I have downloaded the repository from Github and the third party package is present. However, I want to use the python package I currently have on my computer (python 3.5.2 through Anaconda) on my windows 10 machine.

Due to the fact that I have the package of python I want to use not being located under the thirdparty directory, the script is complaining to me about not finding the python.exe file under the thirdparty directory. I do have the instance of python under the system path for python.

What do I need to change so I can compile and install panda3d as a package to my anaconda instance of python?

it would be great if I could tell it something like this:

python makepanda/makepanda.py

etc. and not have it look for an instance of python under it’s own directory and instead use the one I have.

Rather than running makepanda.bat, you need to run makepanda.py explicitly with the version of Python you would like to use. For example:

thirdparty\win-python3.5-x64\python.exe makepanda/makepanda.py --everything --msvc-version=14 --windows-sdk=10

Thanks for responding.
I am pointing to the .py and not the .bat file. The problem seems to be that there is the expectation that the python.exe file is located under the thirdparty folder (which it is not).
I have a version of python installed on my machine that I would like to use, but this is not in the pre-defined path that the script is checking, and subsequently I get this error:

Could not find thirdparty/win-python3.5-x64/python.exe!

Ah, yes. Makepanda currently expects the copy of Python to be in the thirdparty dir since it wants to bundle it along into the installer.

I suggest that you either copy (or perhaps symlink) the entire Python installation directory to the thirdparty dir. Otherwise, you could try editing makepandacore.py, looking for SdkLocatePython, and set SDK[“PYTHON”], SDK[“PYTHONVERSION”] and SDK[“PYTHONEXEC”] yourself.

I dont have W10 SDK, Im using W7 + VS2015, I tried it and got this:

C:\Users\Peter\Desktop\panda3d>thirdparty\win-python3.5-x64\python.exe makepanda/makepanda.py --everything --msvc-version=14 --windows-sdk=8.1 --verbose
Version: 1.10.0
Using Python 3.5 build located at thirdparty/win-python3.5-x64
Using Windows SDK 8.1 located at C:\Program Files (x86)\Windows Kits\8.1\
Using Visual Studio 14.0 located at C:\Program Files (x86)\Microsoft Visual Studio 14.0\
Using compiler: MSVC
Host OS: windows
Host arch: x64
Target OS: windows
Target arch: x64
Using thirdparty directory: thirdparty/win-libs-vc14-x64/
WARNING: Could not locate thirdparty package fftw, excluding from build
WARNING: Could not locate thirdparty package opencv, excluding from build
WARNING: Could not locate thirdparty package awesomium, excluding from build
WARNING: Could not locate thirdparty package rocket, excluding from build
Writing built_x64/pandac/extension_native_helpers.py
Writing built_x64/etc/Config.prc
Writing built_x64/etc/Confauto.prc
mt -inputresource:"thirdparty/win-python3.5-x64\python.exe";#1 -out:"built_x64/tmp/python.manifest" -nologo
Storing dependency cache.
Elapsed Time: 1 sec
Cannot find mt on search path
Build terminated.

Hmm, odd. I’ve never tried building with the Windows 8.1 SDK though.

Could you try running the command it’s complaining about in the Visual Studio Command Prompt, to see what kind of error message you get?

mt -inputresource:"thirdparty/win-python3.5-x64\python.exe";#1 -out:"built_x64/tmp/python.manifest" -nologo

Good news. There are several command prompts. If I try to compile in: VS2015 x64 Native Tools Command Prompt, it works. :wink:

i cant compile using the thirdparty, it get stuck at 24%, exactly building composite2.obj, any idea what could be wrong? could anyone compile it (i just really need assimp) and upload it for me?

composite2.obj doesn’t tell me anything; that’s not the complete file. I suspect it’s merely a big file, though, so I would suggest you wait.

You could use --no-eigen in the compilation flags to get a significantly faster build. You should also use --threads 2 (or as many cores as you can spare) to significantly speed up the build.

Some updates, a few new and a few old:

  • Python 3.6.1 is now included.
  • I have posted 32-bit versions of the thirdparty packages.
  • The buildbot now uses VS 2015 to produce the Python 3.5 and 3.6 builds.
  • Panda now compiles successfully on the Express version of VS 2015.
  • Makepanda now also builds assimp on Windows.
  • The thirdparty packages have been built against the v140_xp toolset for Windows XP compatibility.
  • It is no longer necessary to set makepanda to use the Windows 10 SDK; leaving it on the 7.1 SDK will keep the build compatible with Windows XP. You will still need the Windows 10 SDK installed for the Universal CRT, however.

Updates:

  • Assimp has been updated with a custom bugfix to prevent a crash on library load.
  • HarfBuzz is now included.