mujoco_mpc icon indicating copy to clipboard operation
mujoco_mpc copied to clipboard

A faulty patch causes long rebuild times

Open keszegrobert opened this issue 1 year ago • 0 comments

There is a huge amount of commands listed here one add_custom_target

https://github.com/google-deepmind/mujoco_mpc/blob/9bd2037498056a0ab9cf9463ab841e40fef54142/mjpc/tasks/CMakeLists.txt#L18

Even if one of the command fails (it does), it must rerun all the rules in the generated rules file. ChatGPT recommended me to do the commands separately:

add_custom_command(
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/humanoid/humanoid.xml"
    COMMAND ${CMAKE_COMMAND} -E copy
            "${dm_control_SOURCE_DIR}/dm_control/suite/humanoid.xml"
            "${CMAKE_CURRENT_BINARY_DIR}/humanoid/humanoid.xml"
    DEPENDS "${dm_control_SOURCE_DIR}/dm_control/suite/humanoid.xml"
    COMMENT "Copying humanoid.xml for humanoid model"
)

then link the output xml as a dependency:

add_custom_target(copy_model_resources ALL
    DEPENDS
        "${CMAKE_CURRENT_BINARY_DIR}/humanoid/humanoid.xml"
        ...
)

The root cause of the issue is that patching of common_assets/reorientation_cube.xml fails due to a missing EOLN at column 26 here https://github.com/google-deepmind/mujoco_mpc/blob/9bd2037498056a0ab9cf9463ab841e40fef54142/mjpc/tasks/common_assets/cube.xml.patch#L1

The patch tool returns an error code and writes this in the output: missing header for unified diff at line 3 of patch

keszegrobert avatar Nov 19 '24 21:11 keszegrobert