How to let FastBuild work on linux?

I’m new on using both UE and FastBuild.
It took a long time to understand how to compile FastBuild for linux.
So I prepared this quick guide for UE4.27.0 on Ubuntu20.04:

# compile FastBuild with UnrealEngine patch on Ubuntu20.04 (these commands are meant to be run manually on a terminal)
# check what fbuild patch version is required at: ./Engine/Extras/ThirdPartyNotUE/FASTBuild/*.diff #ex.: 0.99
strPath="`pwd`/Engine/Extras/ThirdPartyNotUE/FASTBuild/Linux/dist_v0.99/" # download and extract fbuild sorce code to a folder like this (inside your UE install path)
cd "$strPath"
chmod -vR u+w * # make it sure the extracted files all have write permission!
patch --binary -p 1 <../../fbuild_0.99.diff # I think this file was downloaded from somewhere by Setup.sh or GenerateProjectFiles.sh or may be thru make (mono), as I cant find it's origin to report the bug at the end of this text about FBuildCoordinator.bff
sudo apt install clang g++-7
#$head "$strPath/External/SDK/Clang/Linux/Clang6.bff"
sed -i -r "s@(^.Clang6_BasePath = ').*(')@\1$(dirname $(which clang))\2@" "$strPath/External/SDK/Clang/Linux/Clang6.bff" # to match installed clang
#$head "$strPath/External/SDK/Clang/Linux/Clang6.bff"
cd "$strPath/Code"
chmod +x ../Bin/Linux-x64/fbuild
# run fbuild below.
#  there may have dependencies like clang and g++-7 that you will need to install on your OS. 
#  If it fails in the end, run it again a few times until you see a `ld` complaint about missing libraries ex.: -lFuzzer,-lc++,-lc++abi,-lunwind. 
#  ForUbuntu20.04: Unwind indirectly need this: https://ubuntu.pkgs.org/20.04/ubuntu-updates-main-amd64/liblzma-dev_5.2.4-1ubuntu1_amd64.deb.html (not present on ubuntu repositories) as liblzma5_5.2.4-1_amd64.deb cannot replace liblzma5_5.2.4-1ubuntu1 package w/o breaking a lot of things... 
sudo apt install libc++abi-dev libunwind-dev libfuzzer-10-dev libfuzzer-10-dev #liblzma-dev
../Bin/Linux-x64/fbuild # add -verbose to help
#(OPTIONAL) if libfuzzer-10-dev give code compilation errors like "undefined reference":
  sed -i -r "s@(ExtraLinkerOptions_MSan = '.*)(')@\1 -lstdc++\2@" "$strPath/Code/Tools/FBuild/BFFFuzzer/BFFFuzzer.bff"
  ../Bin/Linux-x64/fbuild
#(OPTIONAL) if you built the specific fuzzer version explained at: ./Engine/Extras/ThirdPartyNotUE/FASTBuild/Linux/dist_v0.99/Code/Tools/FBuild/BFFFuzzer/README.md
  export LIBRARY_PATH="$LIBRARY_PATH:$strPath/../llvm-5.0.0.src/lib/Fuzzer" # it IS LIBRARY_PATH not LD_LIBRARY_PATH
  ../Bin/Linux-x64/fbuild
#(OPTIONAL) error: objcopy: '../tmp/x64ClangLinux-Release/ToolsFBuildFBuildCoordinator/fbuildcoordinator': No such file
  #change in the FBuildCoordinator.bff file: 
    #`.ProjectPath        = 'Tools\FBuild\FBuildCoordinator'` to `.ProjectPath        = 'Tools/FBuild/FBuildCoordinator'`
  #OR follow the hardest path:
    ../Bin/Linux-x64/fbuild -verbose #to see the problematic "\": /bin/bash -c "objcopy --only-keep-debug ../tmp/x64ClangLinux-Release/Tools\FBuild\FBuildCoordinator/fbuildcoordinator ../tmp/x64ClangLinux-Release/Tools\FBuild\FBuildCoordinator/fbuildcoordinator.debug && objcopy --strip-debug ../tmp/x64ClangLinux-Release/Tools\FBuild\FBuildCoordinator/fbuildcoordinator && objcopy --add-gnu-debuglink ../tmp/x64ClangLinux-Release/Tools\FBuild\FBuildCoordinator/fbuildcoordinator.debug ../tmp/x64ClangLinux-Release/Tools\FBuild\FBuildCoordinator/fbuildcoordinator"
    egrep "objcopy" ../* -rnI #see files that need patching
    FUNChope() { echo -E "PROBLEM(WrongBackslash): $@";acmd=();while ! ${1+false};do acmd+=($(echo "$1" |sed -r 's"[\]"/"g'));shift&&:;done; declare -p acmd; set -x; "${acmd[@]}"; set +x; };export -f FUNChope; #brings hope
    sed -i -r -e "s@'objcopy@'FUNChope objcopy@" -e '/objcopy/ s@([$]LinkerOutput[$])@"\1"@g' ../Code/Tools/FBuild/FBuildCoordinator/FBuildCoordinator.bff #fix the file (is there a better way?)
    ../Bin/Linux-x64/fbuild

It compiled, but I still need to test it. I may need to prepare the BuildConfiguration.xml, and to test if it is working on the other machines.

Feel free to post here your quick guide about other UE versions, or improvements to this one like the missing steps to test and make it fully work.

This (config) may help? Official FastBuild integration

PS.: if I cant update this post and succeed, look for “OP_UPDATE” on this thread.