adamrehn / ue4-docker

Windows and Linux containers for Unreal Engine 4
https://docs.adamrehn.com/ue4-docker/
MIT License
777 stars 172 forks source link

xbuild: command not found in RunUAT.sh on UE-4.20 #204

Closed slonopotamus closed 1 year ago

slonopotamus commented 2 years ago

Output of the ue4-docker info command:

$ ue4-docker info
ue4-docker version:         0.0.90 (latest available version is 0.0.90)
Operating system:           Linux (Gentoo/Linux, 5.10.52-gentoo-x86_64)
Docker daemon version:      20.10.7
NVIDIA Docker supported:    No
Maximum image size:         No limit detected
Available disk space:       572.47 GiB
Total system memory:        31.32 GiB physical, 32 GiB virtual
Number of processors:       8 physical, 16 logical

Additional details:

Way to reproduce:

  1. Linux
  2. ue4-docker build 4.20.3 --no-engine --exclude ddc --exclude debug --exclude templates
  3. ue4-docker test 4.20.3

Expected: test passes

Actual:

$ ue4-docker test 4.20.3
[ue4-docker test] Starting a container using the "adamrehn/ue4-full:4.20.3" image...
[ue4-docker test] Running test "build-and-package.py"...
[RUN COMMAND] ['git', 'clone', '--depth=1', 'https://gitlab.com/ue4-test-projects/4.20/BasicCxx.git', '/tmp/tmp3kek3inc/BasicCxx'] {}
Cloning into '/tmp/tmp3kek3inc/BasicCxx'...
[RUN COMMAND] ['ue4', 'package', 'Shipping'] {'cwd': '/tmp/tmp3kek3inc/BasicCxx'}

Running AutomationTool...

AutomationTool exists: Deleting
Deleting all AutomationScript dlls
Compiling AutomationTool with xbuild
xbuild Source/Programs/AutomationTool/AutomationTool.csproj /p:Configuration=Development /p:Platform=AnyCPU /verbosity:quiet /nologo /p:TargetFrameworkProfile=
/home/ue4/UnrealEngine/Engine/Build/BatchFiles/RunUAT.sh: line 79: xbuild: command not found
RunUAT ERROR: AutomationTool failed to compile.
Using user-specified engine root: /home/ue4/UnrealEngine
Traceback (most recent call last):
  File "/usr/local/bin/ue4", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/ue4cli/cli.py", line 222, in main
    SUPPORTED_COMMANDS[command]['action'](manager, args)
  File "/usr/local/lib/python3.6/dist-packages/ue4cli/cli.py", line 94, in <lambda>
    'action': lambda m, args: m.packageDescriptor(os.getcwd(), args),
  File "/usr/local/lib/python3.6/dist-packages/ue4cli/UnrealManagerBase.py", line 454, in packageDescriptor
    self.packageProject(dir, args[0] if len(args) > 0 else 'Shipping', args[1:])
  File "/usr/local/lib/python3.6/dist-packages/ue4cli/UnrealManagerBase.py", line 429, in packageProject
    ] + extraArgs)
  File "/usr/local/lib/python3.6/dist-packages/ue4cli/UnrealManagerBase.py", line 371, in runUAT
    Utility.run([self.getRunUATScript()] + args, cwd=self.getEngineRoot(), raiseOnError=True)
  File "/usr/local/lib/python3.6/dist-packages/ue4cli/Utility.py", line 145, in run
    raise Exception('child process ' + str(command) + ' failed with exit code ' + str(returncode))
Exception: child process ['/home/ue4/UnrealEngine/Engine/Build/BatchFiles/RunUAT.sh', 'BuildCookRun', '-utf8output', '-clientconfig=Shipping', '-serverconfig=Shipping', '-project=/tmp/tmp3kek3inc/BasicCxx/BasicCxx.uproject', '-noP4', '-cook', '-build', '-stage', '-prereqs', '-pak', '-archive', '-platform=Linux', '-nodebuginfo', '-allmaps', '-archivedirectory=/tmp/tmp3kek3inc/BasicCxx/dist'] failed with exit code 1
Using user-specified engine root: /home/ue4/UnrealEngine
Traceback (most recent call last):
  File "/tmp/workspace/build-and-package.py", line 22, in <module>
    run(["ue4", "package", "Shipping"], cwd=projectDir)
  File "/tmp/workspace/build-and-package.py", line 8, in run
    return subprocess.run(command, check=True, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ue4', 'package', 'Shipping']' returned non-zero exit status 1.
[ue4-docker test] Error: test "build-and-package.py" failed!

Initial analysis:

  1. We don't have system mono installed. It is installed by Setup.sh, but we only run that in ue4-source.
  2. RunUAT.sh in 4.20 is missing a call to SetupMono.sh that was added in 4.21, so it doesn't use bundled version of Mono
slonopotamus commented 2 years ago

Suggested fix: add missing SetupMono.sh call. But be careful with 4.26+: https://github.com/EpicGames/UnrealEngine/commit/54437183ba91c305c2b8cfe0574e29b1e83be2d8#diff-a4b6f4db17a499341d06e2ffcdf8d0e0ef2b94f89ab545f1ddc15ca0e9fa0388L59-R60

meetakshay99 commented 2 years ago

Yes, adding the call for SetupMono.sh fixes the problem. The error of xbuild: command not found does not occur anymore.

adamrehn commented 2 years ago

@slonopotamus I reckon the most appropriate place for this would be in patch-broken-releases.py, since it's where we currently implement version-specific patching logic.

slonopotamus commented 2 years ago

I am actually not sure that ad-hoc strings replacement in random engine files is a good idea in a long-term. A kinda better solution would be to just keep those changes in UE fork. We should not try to fix each and every engine bug and such approach (with a fork) makes it much easier to see which changes are relevant to what engine versions.

slonopotamus commented 1 year ago

Given that we're going to drop 4.20 support (https://github.com/adamrehn/ue4-docker/issues/296#issuecomment-1451285462) and there is a workaround (patch your engine fork), I want to close this as WONTFIX.