Skip to content

Building the CPP Modules

tobspr edited this page Dec 7, 2016 · 26 revisions

The pipeline provides several C++ modules. There is a python implementation of them, too, but it is slower, and not all features are implemented. You should choose the C++ build option if possible.

Requirements for building the C++ modules

  • cmake 2.6 or newer
  • Panda3D 1.10 (recent version from here or self-built

Additionally on windows:

  • Visual Studio 2010 / 2015 *
  • Windows 7.1 SDK (Or for visual studio 2015: Windows 10 SDK)

If you use Visual Studio 2015, you need a Panda3D build compiled with that version, too. Checkout Building Panda3D with MSVC 2015 and Python 3.5 and Installing the Visual Studio Compiler

If you use a precompiled Panda3D build on windows, make sure you copied the thirdparty folder into it. After you installed all prerequisites, you can simply run the setup.py. It should take care of compiling all modules.

Another notice: If you compile Panda3D yourself, and use a different optimize option than 3, you also have to change the optimize version in rpcore/native/config.ini to make sure everything is linked correctly.

Troubleshooting

The setup.py script attempts to build native code automatically for you, but may run into issues.

Windows-Specific

"Error: Could not find cmake"

This one is obvious - you didn't install cmake. If you did install cmake, make sure you selected Add CMake to the system path during the setup. Ensure that cmake is installed properly by running cmake --version in a command shell.

"No CMAKE_C_COMPILER could be found. / No CMAKE_CXX_COMPILER could be found."

Make sure you installed all prerequisites stated above - especially the required Visual Studio version and the Windows SDK.

If you are still running into problems during compilation, you might have to run C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd /x64 /Release to setup all environment variables.

Does not match the generator used previously: Visual Studio 10 2010 Win64

Run setup.py --clean to clean up previous build files, this occurs after changing config.ini

"Cannot open include file: 'ft2build.h'"

Make sure you copied the thirdparty folder into your Panda3D installation. If you downloaded a buildbot build, just copy it into your built, if you compiled it yourself, you might have to copy it to two places: The source repository, and the built/built_x64 folder.

"Illegal option: -n"

This is caused by an outdated Panda3D build. Make sure you have a recent version, by either getting a precompiled development build, or compiling from source.

All Systems

"CMake Error: Does not match the generator used previously"

This means you ran the setup earlier with different options. Run setup.py --clean to resolve the issue.

"CMake Error: The current CMakeCache.txt directory is different"

This means you moved the render pipeline folder, run setup.py --clean to resolve the issue.

"Could not find Panda3d headers"

If you see:

Could NOT find Panda (missing:  PANDA_LIBRARIES PANDA_INCLUDE_DIR)
CMake Error at CMakeLists.txt:126 (message):
  Could not find panda3d headers!

... then be sure the environment variables PATH, PYTHONPATH, and LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (Mac OS X) can find Panda3D libraries and binaries, and try setup.py again.

If the setup still fails with Setup failed, you will need to manually fix up the cmake configuration:

  • chdir into <render_pipeline>/rpcore/native/<arch> (where matches the OS and CPU of your system, e.g. linux_amd64)
  • run cmake-gui .. (if you don't have it, install it)

NOTE: run setup.py first, even if you will use cmake-gui from scratch, since it sets up some basic entries for you. If you're clever enough, check rpcore/native/scripts/setup.py to see how it constructs the cmake command line.

Super-quicky cmake-gui tutorial

cmake-gui will highlight entries it failed to detect in red.

Edit these to be correct.

Click Configure to try again. cmake will re-run the discovery logic and try again, using the new entries or recalculating removed entries.

If this succeeds (no red text), then click Generate. When that succeeds, go back and run setup.py again to finish.

Also, the entire <arch> directory under rpcore/native/ is auto-generated; if you get stuck somewhere, you can delete it to start fresh.

  • Could not find Panda3D variables?

You may need to edit the PANDA_... entries to match your build. For example, on Linux systems:

> `PANDA_INCLUDE_DIR` is `.../panda3d/built/include`
> `PANDA_LIBRARY_<foo>` is `.../panda3d/built/lib/lib<foo>.so`
  • Mismatched Python?

In the configuration step, if you see:

-- Found PythonLibs: .../libpython3.4m.so (found version "3.4.0")
-- Found PythonInterp: .../python (found version "2.7.9")

Then, you need to correct this. Edit the PYTHON_INCLUDE_DIR and/or PYTHON_LIBRARY entries to match your system. (On Linux, for example, you can use dpkg -L libpython2.7 to find out where the *.so lives.)

After all such corrections, re-run setup.py again to finish the setup.