Skip to content

Build fails with -DUSE_EMBEDDED_PYTHON=On #376

@planepaper

Description

@planepaper

Environment

  • OS: Ubuntu 24.04
  • Compiler: GCC 14.2.0
  • CMake: 3.28.3
  • Branch/commit: master/c5a063d

Context

There are example scenes (e.g. under data/Scenes/AnimatedBody_2D.json) that use embedded
Python scripts to animate rigid bodies dynamically. These scenes require
-DUSE_EMBEDDED_PYTHON=On to function. However, this option cannot be
built successfully, making these examples completely unusable.

I also checked out the commit(tag:2.10.0) where USE_EMBEDDED_PYTHON support was
originally introduced, and the build failed there as well with the same
errors — so this feature appears to have never been buildable.

Steps to Reproduce

cmake -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHON_BINDINGS=On -DUSE_EMBEDDED_PYTHON=On ..

Error

CMake configuration fails with:
The dependency target "pysplishsplash_embed" of target "SimulatorBase" does not exist.

This happens because add_subdirectory(Simulator) is processed before
add_subdirectory(pySPlisHSPlasH) in the top-level CMakeLists.txt,
so pysplishsplash_embed does not exist yet when Simulator/CMakeLists.txt
adds it to SIMULATION_DEPENDENCIES.

After commenting out pysplishsplash_embed from SIMULATION_DEPENDENCIES,
the build progresses but hits a second error:
Target "SimulatorBase" links to: pybind11::embed but the target was not found.

pySPlisHSPlasH/CMakeLists.txt references pybind11::embed, but the
bundled extern/pybind/CMakeLists.txt only defines pybind11::headers
pybind11::embed does not exist.

My Understanding (may be incorrect)

It seems like there is a circular dependency between SimulatorBase and
pysplishsplash_embed:

  • Simulator/CMakeLists.txt links SimulatorBase to pysplishsplash_embed
  • pySPlisHSPlasH/CMakeLists.txt links pysplishsplash_embed to SimulatorBase

Combined with the subdirectory ordering and the missing pybind11::embed
target, building with -DUSE_EMBEDDED_PYTHON=On does not seem possible
with the current CMake configuration.

I may be misunderstanding the intended build setup, so any guidance on
how to correctly build with this option would be appreciated.

Expected Behavior

-DUSE_EMBEDDED_PYTHON=On should configure and build successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions