Dear everyone,
We are trying to compile the PhysX libraries for mobile platforms, to achieve runtime physics cooking (we know it’s not recommended due to performance). So what we did is we cloned the source of the engine, and according to Master Kenth’s original idea we modified parts to include the PhysX libraries in the cooking proccess. Namely we did the following changes:
\ThirdParty\PhysX\PhysX.Build.cs: Under string[] StaticLibrariesAndroid = new string[] { we changed:
//"PhysX3Cooking{0}", to
"PhysX3Cooking{0}",
in UnrealBuildTool\Android\UEBuildAndroid.cs we changed:
UEBuildConfiguration.bRuntimePhysicsCooking = false; to
UEBuildConfiguration.bRuntimePhysicsCooking = true;
and for our project build.cs we added the following:
public override void SetupGlobalEnvironment(
TargetInfo Target,
ref LinkEnvironmentConfiguration OutLinkEnvironmentConfiguration,
ref CPPEnvironmentConfiguration OutCPPEnvironmentConfiguration
)
{
UEBuildConfiguration.bCompilePhysX = true;
UEBuildConfiguration.bRuntimePhysicsCooking = true;
OutCPPEnvironmentConfiguration.Definitions.Add("WITH_RUNTIME_PHYSICS_COOKING=1");
}
We compiled the engine. All went well, no issues at all. So we loaded our solution of the test project itself, added the nodes which caused problems before, and started to build. It looked like all goes well, however at the end of the build proccess we get this error:
3> [280/280] clang++.exe MobileTest-Android-DebugGame-armv7-es2.so
3>C:/NVPACK/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld : error : cannot find -lPhysX3CookingPROFILE
3> D:\SOURCES\UnrealEngine4\UnrealEngine\Engine\Source\Runtime\Engine\Private\PhysicsEngine/PhysLevel.cpp:330: error: undefined reference to 'PxCreateCooking(unsigned int, physx::PxFoundation&, physx::PxCookingParams const&)'
3>clang++.exe : error : linker command failed with exit code 1 (use -v to see invocation)
3>ERROR : UBT error : Failed to produce item: C:\Users\lostr\Documents\Unreal Projects\MobileTest\Binaries\Android\MobileTest-Android-DebugGame-armv7-es2.so
3> Total build time: 1220,65 seconds
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.targets(41,5): error MSB3075: The command "D:\SOURCES\UnrealEngine4\UnrealEngine\Engine\Build\BatchFiles\Build.bat MobileTest Android DebugGame "C:\Users\lostr\Documents\Unreal Projects\MobileTest\MobileTest.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 0 succeeded, 2 failed, 1 up-to-date, 1 skipped ==========
We are having a hard time doing minor changes and recompiling everything because of hardware limitations, the build times can be horribly long. Do anyone has an idea what to do and where exactly? We are suspecting that the problem is Nvidia related with the correct profiles not being included in their NVPACK. “arm-linux-androideabi/bin\ld : error : cannot find -lPhysX3CookingPROFILE” is the part which suggests this.
Thank you everyone in advance!