See Windows Part 2b/Linux Part 2b below for a more robust method to recompile the PhysX library for Windows/Linux respectively (UE4.14.3).
This is a better method using RunUAT.bat (from PhysX Source Guide | Unreal Engine Community Wiki / [URGENT] Default Movement Component causing major dedicated server performance issues (Linux Only))
Windows
Windows Part 1 (Download UE4.14.3 source):
Open git command line
cd X:/USERFOLDER
git clone https://github.com/EpicGames/UnrealEngine.git
cd UnrealEngine
git checkout tags/4.14.3-release
apply fix2 (`Failed to download 'http://cdn.unrealengine.com/dependencies/..': The remote server returned an error`);
go to https://github.com/EpicGames/UnrealEngine/releases/tag/4.14.3-release
download Commit.gitdeps.xml
copy Commit.gitdeps.xml X:/USERFOLDER/UnrealEngine/Engine/Build/Commit.gitdeps.xml
Install Linux cross-compile toolchain for UE4.14.3;
https://docs.unrealengine.com/4.26/en-US/SharingAndReleasing/Linux/GettingStarted/
https://cdn.unrealengine.com/CrossToolchain_Linux/v8_clang-3.9.0-centos7.exe
Setup.bat [download dependencies]
GenerateProjectFiles.bat
Windows Part 2a (patch UE4.14.3 PhysX library for Linux UB20.04):
Open;
X:\USERFOLDER\UnrealEngine\Engine\Source\ThirdParty\PhysX\PxShared\src\compiler\cmake\Linux\CMakeLists.txt
X:\USERFOLDER\UnrealEngine\Engine\Source\ThirdParty\PhysX\PhysX_3.4\Source\compiler\cmake\Linux\CMakeLists.txt
X:\USERFOLDER\UnrealEngine\Engine\Source\ThirdParty\PhysX\APEX_1.4\compiler\cmake\Linux\CMakeLists.txt
remove all instances; " -ffast-math"
Windows Part 2b (recompile UE4.14.3 PhysX library for Windows):
apply fix6 (`Program.Main: ERROR: AutomationTool terminated with exception: System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified.. UnrealEngine\Engine\Source\Programs\AutomationTool\AutomationUtils\ProcessUtils.cs :line 797`);
open X:/USERFOLDER/UnrealEngine/Engine/Source/Programs/AutomationTool/Scripts/BuildPhysX.Automation.cs
//[RequireP4] (comment out line)
cd X:/USERFOLDER/UnrealEngine/Engine/Build/BatchFiles
call RunUAT.bat BuildPhysX -TargetPlatforms=Win64 -TargetConfigs=profile+release+checked -TargetWindowsCompilers=VisualStudio2015 -SkipCreateChangelist
Windows Part 3 (compile UE4.14.3 with updated PhysX library):
Open X:/USERFOLDER/UnrealEngine/UE4.sln
select build type [Development/..]
build
cd Engine/Binaries/Win64/
open UE4Editor.exe
Linux
Linux Part 1 (Download UE4.14.3 source):
cd /USERFOLDER
git clone https://github.com/EpicGames/UnrealEngine.git
cd UnrealEngine
git checkout tags/4.14.3-release
apply fix1 (`Package clang-3.9 is not available, but is referred to by another package`);
nedit /USERFOLDER/UnrealEngine/Engine/Build/BatchFiles/Linux/Setup.sh
remove `clang-3.9` reference from `DEPS` `assume the latest, this is going to be a moving target`
apply fix4 (`Package clang-3.9 is not available, but is referred to by another package`);
download and extract https://releases.llvm.org/3.9.0/clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
cd clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04
sudo cp -r * /usr/local/
sudo ln -s /usr/local/bin/clang++ /usr/local/bin/clang++-3.9
apply fix2 (`Failed to download 'http://cdn.unrealengine.com/dependencies/..': The remote server returned an error`);
go to https://github.com/EpicGames/UnrealEngine/releases/tag/4.14.3-release
download Commit.gitdeps.xml
cp Commit.gitdeps.xml /USERFOLDER/UnrealEngine/Engine/Build/Commit.gitdeps.xml
./Setup.sh [download dependencies]
./GenerateProjectFiles.sh
Linux Part 2b (recompile UE4.14.3 PhysX library for Linux) [using Windows]:
Switch to Windows UE4.14.3 source folder
Add an environment variable named LINUX_ROOT, the value of which is the absolute path to your toolchain (without a trailing backslash):
Control Panel->System->Advanced system settings->Advanced->Environment variables->New
LINUX_ROOT
C:\UnrealToolchains\v8_clang-3.9.0-centos7\x86_64-unknown-linux-gnu
apply fix6 (already done)
cd X:/USERFOLDER/UnrealEngine/Engine/Build/BatchFiles
call RunUAT.bat BuildPhysX -SkipCreateChangelist -SkipSubmit -TargetLibs=PhysX+APEX -TargetPlatforms=Linux -TargetConfigs=checked+profile+release
copy all X:\USERFOLDER\UnrealEngine\Engine\Source\ThirdParty\PhysX\Lib\Linux\x86_64-unknown-linux-gnu to Linux
Linux Part 3 (compile UE4.14.3 with updated PhysX library):
cd /USERFOLDER
apply fix1 (already done)
apply fix2 (already done);
apply fix3 (`The <sys/sysctl.h> header is deprecated and will be removed`);
nedit /USERFOLDER/UnrealEngine/Engine/Source/Runtime/Core/Public/Linux/LinuxSystemIncludes.h &
//#include <sys/sysctl.h>
apply fix4 (already done)
apply fix5 (`undefined symbol: __atan2f_finite`);
rm /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Lib/Linux/x86_64-unknown-linux-gnu/*.a
copy recompiled libraries X:\USERFOLDER\UnrealEngine\Engine\Source\ThirdParty\PhysX\Lib\Linux\x86_64-unknown-linux-gnu\*.a to /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Lib/Linux/x86_64-unknown-linux-gnu/
make ARGS="-clean"
make
cd Engine/Binaries/Linux/
./UE4Editor
For reference, the previous method I provided to recompile PhysX for Linux UE4.14.3 (using cmake-gui) throws an error at ~90% startup; in nvidia::apex::ApexScene::destroy (this=<optimised out>) mModuleScenes.back()->release()
. If you wish to further debug the previous method;
- change all
clang 3.9.1
toclang 3.9.0
(fixappError called: Assertion failed: Assertion failed: ReaderPos + Num <= ReaderSize
) - move
fix1
beforefix4
- execute
make
for each sub library (PhysX
,APEX
) - Repeat for each build type;
profile
orchecked
orrelease
(seeset var in GUI list; CMAKE_BUILD_TYPE
) - enable PhysX library debugging;
- open
/USERFOLDER/UnrealEngine/Engine/Saved/UnrealBuildTool/BuildConfiguration.xml
- add inside
<BuildConfiguration>
:<bDebugBuildsActuallyUseDebugCRT>true</bDebugBuildsActuallyUseDebugCRT>
- open
- build UE4Editor for debugging;
make ARGS="-clean"
make UE4Editor-Linux-Debug
cd Engine/Binaries/Linux/
gdb -ex run --args UE4Editor-Linux-Debug