Last active
April 24, 2023 12:49
-
-
Save t31k3/3a42714058e4ae6439d597937b6172a9 to your computer and use it in GitHub Desktop.
compile FastBuild with UnrealEngine patch on Ubuntu20.04 (these commands are meant to be run manually on a terminal)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
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 | |
LIBRARY_PATH="$LD_LIBRARY_PATH:$strPath/../llvm-5.0.0.src/lib/Fuzzer";../Bin/Linux-x64/fbuild # 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 newbie path: | |
../Bin/Linux-x64/fbuild -verbose #to see the malignous "\": /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 |
did someone found out how fbuild_0.99.diff is generated? where it comes from? I would like to submit a patch for linux.
Well Epic Games are developing the engine using perforce, and the diff is the file with their perforce changes.
We mere mortals have no access to it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
did someone found out how fbuild_0.99.diff is generated? where it comes from? I would like to submit a patch for linux.