[HowTo] Build O3DE Engine on Linux RHEL/CentOS 8.4
As some of you may have noticed, there is a new big player to the Linux Foundation team: Amazon AWS’ 03DE Engine, as a building block of the new Open 3D Foundation initiative.
A fully open-source emanation of Lumberyard, itself derived from the CryEngine (think CRYSIS), 03DE has plenty of interesting features: cross-platform, multi-backend (DX12-OpenGL-Vulkan-Metal), integrated Qt-based GUI, C++/Python/Lua support, simplified shader language, plugin-based…
But all this is still bleeding edge, no binaries have been released yet. We will thus build O3DE ourselves on Linux RHEL/CentOS 8.4.
- PREREQUISITES
- At least 32 Gb of available disk space;
- To clone the O3DE repository, we need Large File Storage for Git:
$ dnf in git-lfs
- CMake needs to be updated to the CentOS Stream newest version:
$ export REPO=http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages
$ rpm -Uvh $REPO/cmake-3.20.2-1.el8.x86_64.rpm $REPO/cmake-filesystem-3.20.2-1.el8.x86_64.rpm $REPO/cmake-data-3.20.2-1.el8.noarch.rpm $REPO/cmake-rpm-macros-3.20.2-1.el8.noarch.rpm
- 03DE only builds with Clang, LLVM’s alternative to GCC:
$ dnf in clang
$ export CC=/usr/bin/clang
$ export CXX=/usr/bin/clang++
- Other prequisites include cURL, desktop OpenGL & Irrlicht XML:
$ dnf in https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
$ dnf in libcurl-devel mesa-libGL-devel irrXML-devel
2. BUILDING
- We can finally download O3DE itself:
$ git clone https://github.com/Tarnyko/o3de.git
$ cd o3de
(yes, this is my repo; I have patches) - As said below, we will use our own AssImp/Poly2Tri library to compile, which requires Irrlicht’s XML library as a dependency:
$ sed -i ‘/3rdParty::poly2tri/a\ \ \ \ \ \ \ \ \ \ \ \ -lIrrXML’ Code/Tools/SceneAPI/SDKWrapper/CMakeLists.txt - We can now prepare the build:
$ mkdir build && cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DLY_DISABLE_TEST_MODULES=TRUE -DCMAKE_INSTALL_PREFIX=$HOME/o3de - O3DE has just pre-downloaded lots of libraries, including static versions of AssImp/Poly2Tri with broken symbols on CentOS. Let us replace them with our versions:
$ wget http://www.tarnyko.net/repo/libassimp-5.0.1-static-CENTOS84.zip
$ wget http://www.tarnyko.net/repo/libpoly2tri-0.3.3-static-CENTOS84.zip
$ unzip libassimp*.zip -d ~/.o3de/3rdParty/packages/assimp-5.0.1-rev11-multiplatform/assimp/lib/linux/release
$ unzip libpoly2tri*.zip -d ~/.o3de/3rdParty/packages/poly2tri-0.3.3-rev2-multiplatform/poly2tri/lib/linux/Release
$ unzip libpoly2tri*.zip -d ~/.o3de/3rdParty/packages/poly2tri-0.3.3-rev2-multiplatform/poly2tri/lib/linux/Debug - We can now compile:
$ make -j`nproc`
and after ~2h30 (on a 8-core CPU with 16 GB RAM):
$ make install
3. FIXING POST-INSTALLATION
- 03DE does not automatically download its Python runtime for some reason:
$ cd $HOME/o3de/python/
$ chmod a+x pip.sh python.sh
$ sh get_python.sh
nor does it install its own Python modules:
$ ln -s $HOME/o3de/scripts/o3de/o3de $HOME/o3de/python/runtime/python-3.7.10-rev2-linux/python/lib/python3.7/o3de - It also provides a version of OpenSSL incompatible with the CentOS Kerberos library:
$ cd $HOME/o3de/bin/Linux/Release/
$ mv libcrypto.so.1.1 libcrypto.so.1.1.old - Its Qt runtime was also compiled with exposed private APIs, but some sub-runtimes have not been extracted:
$ tar xfvJ ~/.o3de/3rdParty/downloaded_packages/qt-5.15.2-rev4-linux.tar.xz qt/lib/libQt5XcbQpa.so.5.15.1 qt/lib/libQt5DBus.so.5.15.1 -C $PWD --strip-components 2
$ ln -s libQt5XcbQpa.so.5.15.1 libQt5XcbQpa.so.5
$ ln -s libQt5DBus.so.5.15.1 libQt5DBus.so.5 - The Qt WebP plugin looks for another version of the library:
$ ln -s /usr/lib64/libwebp.so.7 /usr/lib64/libwebp.so.6
4. RUNNING
$ LD_PRELOAD=libQt5XcbQpa.so.5 QT_DEBUG_PLUGINS=1 ./o3de
(P.S.: to add debug tracing in the console, run the following commands before launching cmake :
$ sed -i ‘/DEFINES/a\ \ \ \ \ \ \ \ \ \ \ \ AZ_ENABLE_TRACING’ cmake/Platform/Linux/Configurations_linux.cmake
$ sed -i ‘/AZ_ENABLE_TRACING/a\ \ \ \ \ \ \ \ \ \ \ \ AZ_ENABLE_TRACE_ASSERTS’ cmake/Platform/Linux/Configurations_linux.cmake )