See Linux Part 2b/Windows Part 2 below for a method to recompile the PhysX library for Linux/Windows respectively (UE4.14.3).
I resolved the lost libm
*_finite
function support issue by recompiling the third party PhysX library without the cclang -ffast-math
flag (see https://github.com/EpicGames/UnrealEngine/commit/2b6178f2cbd66dbf6a4c550ddc894064d6239add).
I also found a method to recompile the PhysX library for Windows, although it requires additional environment variables for this UE version (see Windows Part 2 below); Build PhysX For UE4 On Windows | Noah Zuo's Blog
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 fix4 (`Package clang-3.9 is not available, but is referred to by another package`);
download and extract https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
cd clang+llvm-3.9.1-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 2a (patch UE4.14.3 PhysX library for Linux UB20.04):
note instances of finite math functions in original PhysX library (these will be removed);
cd /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX
grep -r '\-finite' *
cd /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX
nedit APEX_1.4/compiler/cmake/Linux/CMakeLists.txt PhysX_3.4/Source/compiler/cmake/Linux/CMakeLists.txt PxShared/src/compiler/cmake/Linux/CMakeLists.txt &
remove all instances; " -ffast-math"
verify removed all Linux instances;
cd /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX
grep -r ffast\-math *
Linux Part 2b (recompile UE4.14.3 PhysX library for Linux):
Install dependencies (minimal);
sudo apt-get install cmake-qt-gui
sudo apt-get install nedit
mkdir /USERFOLDER/PhysX414
nedit /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Externals/CMakeModules/Linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake
#MESSAGE("LINUX_ROOT environment variable not defined!")
SET(CMAKE_C_COMPILER /usr/local/bin/clang)
SET(CMAKE_CXX_COMPILER /usr/local/bin/clang++)
export CMAKE_MODULE_PATH=/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Externals/CMakeModules
export GW_DEPS_ROOT=/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX
mkdir /USERFOLDER/PhysX414/Lib
mkdir /USERFOLDER/PhysX414/cmakeworking-PhysX
mkdir /USERFOLDER/PhysX414/cmakeworking-APEX
Repeat for each sub library (PhysX, APEX):
cmake-gui
source code;
/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/PhysX_3.4/Source/compiler/cmake/Linux
OR: /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/APEX_1.4/compiler/cmake/Linux
binaries;
/USERFOLDER/PhysX414/cmakeworking-PhysX
OR: /USERFOLDER/PhysX414/cmakeworking-APEX
Configure
Unix Makefiles
Specify toolchain file for cross-compiling
/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Externals/CMakeModules/Linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake
Finish
[will generate an error; PxFoundation.cmake:35 - "STREQUAL" "debug"]
set var in GUI list; CMAKE_BUILD_TYPE release
Configure
Generate
cp /USERFOLDER/PhysX414/cmakeworking-PhysX/*.a /USERFOLDER/PhysX414/Lib
cp /USERFOLDER/PhysX414/cmakeworking-PhysX/pxshared_bin/*.a /USERFOLDER/PhysX414/Lib
cp /USERFOLDER/PhysX414/cmakeworking-APEX/*.a /USERFOLDER/PhysX414/Lib
Linux Part 2c (verify recompiled UE4.14.3 PhysX library for Linux)
verify removed all instances;
cd /USERFOLDER/PhysX414/Lib
grep -r '\-finite' *
The only remaining instances should pertain to strings rather than *-finite function references;
Binary file libNvParameterized.a matches
Binary file libNvParameterizedPROFILE.a matches
APEX_1.4/NvParameterized/src/NvParameterized.cpp: NV_PARAM_TRAITS_WARNING(mParameterizedTraits, "%s: setting non-finite floating point value", _longName); \
APEX_1.4/NvParameterized/src/NvParameterized.cpp: NV_PARAM_TRAITS_WARNING(mParameterizedTraits, "%s[%d]: setting non-finite floating point value", _longName, (int)_i); \
Linux Part 3 (compile UE4.14.3 with updated PhysX library):
cd /USERFOLDER
reapply 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 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
cp /USERFOLDER/PhysX414/Lib/*.a /USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Lib/Linux/x86_64-unknown-linux-gnu/
make ARGS="-clean"
make
cd Engine/Binaries/Linux/
./UE4Editor
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
Setup.bat [download dependencies]
GenerateProjectFiles.bat
Windows Part 2 (recompile UE4.14.3 PhysX library for Windows):
Install dependencies (minimal);
https://cmake.org/download/ (e.g. https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-x86_64.msi)
text editor (e.g. TextPad)
mkdir X:/USERFOLDER/PhysX414/Lib
mkdir X:/USERFOLDER/PhysX414/cmakeworking-PhysX
mkdir X:/USERFOLDER/PhysX414/cmakeworking-APEX
Repeat for each sub library (PhysX, APEX):
open cmake gui
source code;
X:/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/PhysX_3.4/Source/compiler/cmake/windows
OR: X:/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/APEX_1.4/compiler/cmake/windows
binaries;
X:/USERFOLDER/PhysX414/cmakeworking-PhysX
OR: X:/USERFOLDER/PhysX414/cmakeworking-APEX
Configure
Generator: Visual Studio 14 2015
optional platform: x64
use default native compilers
Finish
Environment - Add Entries
GW_DEPS_ROOT X:\USERFOLDER\UnrealEngine\Engine\Source\ThirdParty\PhysX
CMAKE_MODULE_PATH X:\USERFOLDER\UnrealEngine\Engine\Source\ThirdParty\PhysX\Externals\CMakeModules
Configure
Generate
Open X:/USERFOLDER/PhysX414/cmakeworking-PhysX/PhysX.sln generated Visual Studio .sln file
OR: Open X:/USERFOLDER/PhysX414/cmakeworking-APEX/Apex.sln generated Visual Studio .sln file
select build type [release]
build
copy X:/USERFOLDER/PhysX414/cmakeworking-PhysX/release/*.lib X:/USERFOLDER/PhysX414/Lib
copy X:/USERFOLDER/PhysX414/cmakeworking-PhysX/pxshared_bin/release/*.lib X:/USERFOLDER/PhysX414/Lib
copy X:/USERFOLDER/PhysX414/cmakeworking-APEX/release/*.lib X:/USERFOLDER/PhysX414/Lib
Windows Part 3 (compile UE4.14.3 with updated PhysX library):
rm X:/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Lib/Win64/VS2015/*.lib
cp X:/USERFOLDER/PhysX414/Lib/*.lib X:/USERFOLDER/UnrealEngine/Engine/Source/ThirdParty/PhysX/Lib/Win64/VS2015/
Open X:/USERFOLDER/UnrealEngine/UE4.sln
select build type [Development/..]
build
cd Engine/Binaries/Win64/
open UE4Editor.exe
Note Linux UE4.14.3 currently throws an unrelated Error at ~50% startup; “appError called: Assertion failed: Assertion failed: ReaderPos + Num <= ReaderSize”