fix: backport ISPC header generation dependency fixes from upstream to resolve build race condition on Ubuntu 24.04+#9599
Conversation
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
There was a problem hiding this comment.
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.shafter 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.
| 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." |
There was a problem hiding this comment.
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.
| git apply "$workspace_path/Util/Patches/fix-ispc-build-race-condition.patch" || \ | ||
| echo "Warning: ISPC patch already applied or not needed." |
There was a problem hiding this comment.
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.
| 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 |
|
Change to fix them natively https://github.com/CarlaUnreal/UnrealEngine/pull/48 |
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 creation8ba844314a7b: Fixed so ISPC compile actions depend on ISPC header generation actions0162a3fe5bc4: Fixed so ISPC generated headers are added as dependency to compile environment used by generated headers when compiling with -includeheaderse46ab4c78df8: Ensure adaptive module actions always have generated ISPC header paths addedThe 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.shexecution.Fixes #8506
Where has this been tested?
Possible Drawbacks
UEBuildModuleCPP.csis updated independently, the patch may fail to apply (handled gracefully with a warning message).This change is