Unable to compile as soon as Source folder exists

I am struggling for days on this issue and hope someone will help me out.
I am using command line to compile project using RunUAT.sh on Mac, and it works fine with a blank Blueprint project. As soon as I add c++ class, it creates a Source folder in directory structure and compilation fails with:

> PhaseScriptExecution Copy\ Executable\ and\ Staged\ Data\ into\ .app /Users/laurent/Documents/Unreal\ Projects/MyProjectOK/Binaries/MyProjectKO\ (IOS).build/IOS/MyProjectKO.build/Script-60EA924CBF6D06502CB41702.sh (in target 'MyProjectKO' from project 'MyProjectKO (IOS)')
>     cd /Users/laurent/Documents/Unreal\ Projects/MyProjectOK/Intermediate/ProjectFilesIOS
>     /bin/sh -c /Users/laurent/Documents/Unreal\\\ Projects/MyProjectOK/Binaries/MyProjectKO\\\ \\\(IOS\\\).build/IOS/MyProjectKO.build/Script-60EA924CBF6D06502CB41702.sh
> Copying executable and any standalone dylibs into /Users/laurent/Documents/Unreal Projects/MyProjectOK/Binaries/IOS/MyProjectKO-IOS-Shipping.app but do not overwrite unless src is newer
> rsync: link_stat "/Users/laurent/Documents/Unreal Projects/MyProjectOK/Binaries/IOS/MyProjectKO-IOS-Shipping" failed: No such file or directory (2)
> rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/e0873e53-5185-11ef-9a51-9ab6d782fe32/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
> Command PhaseScriptExecution failed with a nonzero exit code
> 
> ** BUILD FAILED **
> 
> 
> The following build commands failed:
>     PhaseScriptExecution Copy\ Executable\ and\ Staged\ Data\ into\ .app /Users/laurent/Documents/Unreal\ Projects/MyProjectOK/Binaries/MyProjectKO\ (IOS).build/IOS/MyProjectKO.build/Script-60EA924CBF6D06502CB41702.sh (in target 'MyProjectKO' from project 'MyProjectKO (IOS)')
>     Building workspace MyProjectKO_IOS_MyProjectKO with scheme MyProjectKO and configuration Shipping
> (2 failures)
> Stage command time: 11.85 s
> ********** STAGE COMMAND COMPLETED **********

If I remove simply the Source folder, then compilation works. However I need to add c++ code. Any idea ? Thanks

What happens when you try creating a blank C++ project? If that results in success, and you have some progress in your current project, you can just migrate them by right clicking on an asset you wanna transfer, navigating to the Asset Actions menu and then choose the Migrate option. You can also right click on a folder and the migrate option will already be exposed on the menu that pops up.

Thanks for the proposal which I have just tried. Unfortunately same issue. Create Blank C++ project, compile, error

I kept researching a bit the difference in generated files, and the Binaries/XCBuildData/<#>/manifest.json file contains a different value based on compilation with or without source.
“UE_BINARIES_DIR”:“/Users/laurent/Documents/Unreal Projects/MyProjectOK/Binaries/IOS” → FAIL
“UE_BINARIES_DIR”:“/Users/Shared/Epic Games/UE_5.4/Engine/Binaries/IOS” → OK

Which seems the root cause based on messages Xcode gives me when I try to compile.
Now, how to force UE to generate the proper binaries folder ?

Did you figure out a solution for this? Having the same issue.

Have you solved this problem? I have the same problem.