Skip to content

fix: backport ISPC header generation dependency fixes from upstream to resolve build race condition on Ubuntu 24.04+#9599

Closed
youtalk wants to merge 1 commit intocarla-simulator:ue5-devfrom
youtalk:fix/ispc-build-race-condition
Closed

fix: backport ISPC header generation dependency fixes from upstream to resolve build race condition on Ubuntu 24.04+#9599
youtalk wants to merge 1 commit intocarla-simulator:ue5-devfrom
youtalk:fix/ispc-build-race-condition

Conversation

@youtalk
Copy link
Copy Markdown
Contributor

@youtalk youtalk commented Mar 21, 2026

Description

Backports ISPC header generation dependency fixes from upstream UE5 to resolve build race condition on Ubuntu 24.04+:

  • ced7a89348af: Moved ISPC header creation logic to after PCH to make sure PCH is not depending on ISPC header creation
  • 8ba844314a7b: Fixed so ISPC compile actions depend on ISPC header generation actions
  • 0162a3fe5bc4: Fixed so ISPC generated headers are added as dependency to compile environment used by generated headers when compiling with -includeheaders
  • e46ab4c78df8: Ensure adaptive module actions always have generated ISPC header paths added

The ISPC generated headers (e.g. Learning.ispc.generated.h, FloatArrayMath.ispc.generated.h) were not properly declared as prerequisites of the C++ compilation actions that include them, causing intermittent build failures during parallel builds. The fix moves ISPC header generation after PCH setup and propagates the generated headers as dependencies to all relevant compile environments.

The patch is applied to the UE5 fork automatically during CarlaSetup.sh execution.

Fixes #8506

Where has this been tested?

  • Platform(s): Ubuntu 24.04 (patch application verified)
  • Python version(s): N/A (build system change)
  • Unreal Engine version(s): UE 5.5 (ue5-dev-carla branch)

Possible Drawbacks

  • The patch needs to be maintained until the CARLA UE5 fork incorporates these upstream fixes natively.
  • If the UE5 fork's UEBuildModuleCPP.cs is updated independently, the patch may fail to apply (handled gracefully with a warning message).

This change is Reviewable

Backport ISPC header generation dependency fixes from upstream UE5 to
resolve build race condition on Ubuntu 24.04+. The ISPC generated
headers (e.g. Learning.ispc.generated.h) were not declared as
prerequisites of the C++ compilation actions that include them, causing
intermittent build failures during parallel builds.

The patch is applied to the UE5 fork during CarlaSetup.sh execution.

Fixes carla-simulator#8506
@youtalk youtalk changed the title fix: backport UE5 ISPC build fixes for Ubuntu 24.04+ fix: backport ISPC header generation dependency fixes from upstream to resolve build race condition on Ubuntu 24.04+ Mar 23, 2026
@youtalk youtalk marked this pull request as ready for review March 23, 2026 20:00
@youtalk youtalk requested a review from a team as a code owner March 23, 2026 20:00
Copilot AI review requested due to automatic review settings March 23, 2026 20:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backports upstream UnrealBuildTool (UBT) ISPC header dependency fixes into the CARLA UE5 fork setup flow to prevent intermittent parallel-build failures (missing *.ispc.generated.h) on Ubuntu 24.04+.

Changes:

  • Add a patch file that adjusts UBT action/dependency ordering for ISPC header generation and compilation.
  • Apply the patch automatically during CarlaSetup.sh after cloning the UE5 fork.
  • Document the fix in CHANGELOG.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Util/Patches/fix-ispc-build-race-condition.patch Adds the upstream UBT changes as a patch to be applied to the UE5 fork.
CarlaSetup.sh Applies the patch after cloning the engine during setup.
CHANGELOG.md Notes the Ubuntu 24.04+ ISPC build race fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +117 to +119
echo "Applying ISPC build race condition fix..."
git apply "$workspace_path/Util/Patches/fix-ispc-build-race-condition.patch" || \
echo "Warning: ISPC patch already applied or not needed."
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ISPC patch is only applied in the fresh-clone branch. If CARLA_UNREAL_ENGINE_PATH is already set or ../UnrealEngine5_carla already exists, this script skips applying the patch, so affected users can still hit the race condition. Consider applying (or at least checking) the patch in those branches too, or documenting that users must re-clone/manual-apply for existing engine checkouts.

Copilot uses AI. Check for mistakes.
Comment on lines +118 to +119
git apply "$workspace_path/Util/Patches/fix-ispc-build-race-condition.patch" || \
echo "Warning: ISPC patch already applied or not needed."
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git apply ... || echo "Warning" treats all failures as non-fatal (including patch drift/conflicts), which can leave the engine unpatched and lead to hard-to-diagnose build failures later. Consider distinguishing "already applied" vs "failed to apply" (eg, via git apply --reverse --check / --check) and exiting on real apply errors.

Suggested change
git apply "$workspace_path/Util/Patches/fix-ispc-build-race-condition.patch" || \
echo "Warning: ISPC patch already applied or not needed."
if git apply --check "$workspace_path/Util/Patches/fix-ispc-build-race-condition.patch"; then
git apply "$workspace_path/Util/Patches/fix-ispc-build-race-condition.patch"
elif git apply --reverse --check "$workspace_path/Util/Patches/fix-ispc-build-race-condition.patch"; then
echo "ISPC patch already applied, skipping."
else
echo "Error: failed to apply ISPC patch." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
@youtalk
Copy link
Copy Markdown
Contributor Author

youtalk commented Mar 23, 2026

Change to fix them natively https://github.com/CarlaUnreal/UnrealEngine/pull/48

@youtalk youtalk closed this Mar 23, 2026
@youtalk youtalk deleted the fix/ispc-build-race-condition branch March 23, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ubuntu Building UE5 Error

2 participants