Building PSUnreal on Linux
Building UEEditor on Linux
References
https://docs.unrealengine.com/en-US/Platforms/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow/index.html
https://www.ue4community.wiki/Legacy/Running_On_Linux https://www.ue4community.wiki/Legacy/Cooking_On_Linux
Some Linux commands
Installation steps
- Register for a free account at github.com
- Per the first link above, join the unreal project
Be sure to install all dependencies first
> sudo apt-key update > sudo apt-get update > sudo apt-get upgrade > sudo apt-get install git
get source code with:
> git clone -b 4.25.2-release https://github.com/EpicGames/UnrealEngine.git
this will create a "UnrealEngine" directory as child of the dir where you run the command
Launch the setup to download all dependencies
> ./Setup.sh
Generate project files
> ./GenerateProjectFiles.sh
Build UnrealEngine
> make
Running the editor
Before moving to PlaneShift Unreal, its best to test if the standard Unreal Engine works.
To do this you need to have X available. If you are in a server only configuration, you need to install X.
> sudo apt-get install xinit > sudo apt-get install ubuntu-desktop
and you need then to start it:
> sudo startx
When you are in X, open a terminal window and
> cd Engine/Binaries/Linux/ > ./UE4Editor
Building PSUnreal
Download the PSUnreal project
> cd \ > svn co svn://xxx.xxx.xxx/psunreal/PSUnreal PSUnreal
You need to install MariaDB Connector from: https://mariadb.com/downloads/#connectors
- Select C connector and the linux platform
- Extract in a temporary directory the file you get
tar -xzvf mariadb-connector-c-3.1.7-linux-x86_64.tar.gz
- From the MariaDB extracted directory, copy both
lib/
andinclude/
(with subfolders) intoPSUnreal\ThirdParty\MariaDB\
cp -r * /home/planeshift/PSUnreal/ThirdParty/MariaDB/
- Recompile Wordnet
> cd /home/planeshift/PSUnreal/ThirdParty/Wordnet/ > gcc -c -fPIC *.h *.c > ar -cvq libWordnet.so *.o > mv libWordnet.so lib/x64/
- generate project files
> /home/planeshift/UnrealEngine/GenerateProjectFiles.sh -project="/home/planeshift/PSUnreal/PSUnreal.uproject" -game -engine
- recompile the project
> /home/planeshift/UnrealEngine/Engine/Build/BatchFiles/Linux/Build.sh PSUnrealEditor Linux Development -Project="/home/planeshift/PSUnreal/PSUnreal.uproject"
- Be sure to have Unreal Engine find all the libraries needed
> export LD_LIBRARY_PATH=/home/planeshift/UnrealEngine/Engine/Binaries/Linux:/home/planeshift/PSUnreal/ThirdParty/MariaDB/lib/mariadb
Package Development server and client
/mnt/nvme/ue/UnrealEngine-4.25/Engine/Build/BatchFiles/RunUAT.sh -ScriptsForProject=<PATH TO PROJECT>.uproject BuildCookRun -project=<PATH TO PROJECT>.uproject -noP4 -clientconfig=Development -serverconfig=Development -utf8output -platform=Linux -server -serverplatform=Linux -targetplatform=Linux -build -cook -allmaps -compressed -stage -archive -unversionedcookedcontent -archivedirectory="<Archive Dir>"
Troubleshooting
File couldn't be loaded by the OS
I got this error:
[2020.05.05-17.04.04:228][ 0]LogCore: Warning: dlopen failed: (null) [2020.05.05-17.04.04:228][ 0]LogModuleManager: Warning: ModuleManager: Unable to load module '/home/planeshift/PSUnreal/Binaries/Linux/libUE4Editor-PSUnreal.so' because the file couldn't be loaded by the OS.
So I used this to get the list of libraries he is in need of
ldd /home/planeshift/PSUnreal/Binaries/Linux/libUE4Editor-PSUnreal.so
and then added the export LD_LIBRARY_PATH mentioned above, and it worked
Same error on PSUpdater module:
[2020.07.03-14.59.50:796][ 0]LogModuleManager: Warning: ModuleManager: Unable to load module '/home/planeshift/PSUnreal/Binaries/Linux/libUE4Editor-PSUpdater.so' because the file couldn't be loaded by the OS.
ldd /home/planeshift/PSUnreal/Binaries/Linux/libUE4Editor-PSUpdater.so
I set the environment variable LD_DEBUG and then launch the program export LD_DEBUG=libs
Can't connect to local MySQL server
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Check your /etc/mysql/my.cnf , and see where is the socket location. for me it was /var/run/mysqld/mysqld.sock , so I added a symbolic link to it.
ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
Some errors that you may encounter along the way
You see a file named something like "GitDependencies-crash.log" in your UnrealEngine directory. The contents of the file contains this message:
mono GitDependencies.exe --prompt crashed with return code 134
Solution: Ensure your copy of mono is up to date and rerun the Setup.sh script At time of writing, I am using mono 3.2.8
Reason - This could be due to an old version of mono, but it seems to happen for other reasons too.
Should probably clean and recompile UEEditor at this point.
user@u13:~/Development/UnrealEngine/Engine/Binaries/Linux$ ./UE4Editor
./UE4Editor: error while loading shared libraries: libLND.so: cannot open shared object file: No such file or directory
To fix this, copy libLND.so (there are several flavors) from another directory to the Binaries/Linux directory. Do not use a symbolic link, just make a copy of the file. On my installation, a sym link worked in some places but failed in miserably others.
$ find ../../../../ -name libLND.so -print
../../../../UnrealEngine/Engine/Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs/lib/Linux/x86_64-unknown-linux-gnu/libLND.so
cp ../../../../UnrealEngine/Engine/Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs/lib/Linux/x86_64-unknown-linux-gnu/libLND.so .
Some fonts are in the wrong place. Its important to fix this
[2015.05.03-07.28.52:548][ 0]LogSlate:Warning: Failed to load font data from '../../../Engine/Content/Slate/Fonts/Roboto-Italic.ttf'
$ find ../../../ -name Roboto-Italic.ttf -print
../../../Engine/Content/Editor/Slate/Fonts/Roboto-Italic.ttf
../../../Engine/Content/Slate/Testing/Fonts/Roboto-Italic.ttf
cp ../../../Engine/Content/Editor/Slate/Fonts/* ../../../Engine/Content/Slate/Fonts/
cp ../../../Engine/Content/Slate/Testing/Fonts/* ../../../Engine/Content/Slate/Fonts/
I don't know what to do about these two errors yet
[2015.05.03-07.29.12:524][ 0]LogDirectoryWatcher:Error: inotify_add_watch cannot watch folder /home/user/Development/UnrealEngine/Engine/Plugins/Experimental/CharacterAI/Content/
[2015.05.03-07.29.12:524][ 0]LogDirectoryWatcher:Warning: Failed to begin reading directory changes for ../../../Engine/Plugins/Experimental/CharacterAI/Content/.
Create and Save the "Blank" project from the Blueprint Tab
once you have the Editor open and working, create the "Blank" project and save it. We need to do this, otherwise we will not be able to cook content later on and will get an error message stating that some folder ( /Saved/Sandbox/DefaultGame/ ? ) is missing. This seems to be some sort of a bug or perhaps lazy initialization.
- Open the editor
- Click on New Project
- Click on "Blank" ( In the Blueprint tab, not the one in the C++ tab )
- Click "Create Project"
- Save All and exit for now.
Clone and Import the psunreal project:
Get the svn password and the link from Talad. We are going to download the source and put it into the UnrealEngine directory in order to work around yet another bug. After that, we run GenerateProjectFiles.sh once more to add our project to The Makefile.
cd ~/Development/UnrealEngine/
svn co svn://super.secret.source.path
we now have ~/Development/UnrealEngine/psunreal. Run the script below to add our project to the Makefile
./GenerateProjectFiles.sh
Open the PSUNREAL project ( finally.. )
Click File and then Open Project
You will now see the Blank Project and another named MyProject2 ( that's ours )
Click MyProject2 and then open.
You will get another error message:
There are a few errors about missing Android stuff. I don't we need to worry about this.
[2015.05.03-08.14.15:716][ 0]LogModuleManager:Warning: ModuleManager: Unable to load module 'AndroidRuntimeSettings' because the file '/home/user/Development2/UnrealEngine/Engine/Binaries/Linux/' was not found.
[2015.05.03-08.14.15:719][ 0]LogModuleManager:Warning: ModuleManager: Unable to load module 'AndroidPlatformEditor' because the file '/home/user/Development2/UnrealEngine/Engine/Binaries/Linux/' was not found.
For this missing font, we need to repeat the solution above for Roboto-Italic...
[2015.05.03-08.14.18:469][ 0]LogSlate:Warning: Failed to load font data from '../../../Engine/Content/Editor/Slate/Fonts/Roboto-Regular.ttf'
[2015.05.03-08.14.18:471][ 0]LogSlate:Warning: Failed to load font data from '../../../Engine/Content/Editor/Slate/Fonts/Roboto-Bold.ttf'
Building, cooking, packaging... oh my.
So when you build the game there are several things that need to be built:
- shaders
- the code itself
- some lighting resources
You also need to cook the game's content. This means, you are taking all the art, models, textures, etc.. and converting them into a format that the Unreal engine likes. When you go to build the game for another platform - like an android tablet, pc, mac, or whatever, it will convert those "assets" into a format that is more suitable for the target platform.
After you have cooked the content, you should be able to "package" the game. This simply means, you are setting up the files that will be distributed to the client. They will be formatted to work on the target platform and will be laid out into a directory structure.
Setting up the server
Follow the instructions in the "Planeshift Compiling Guide" for setting up the mysql database. You'll need to set it up ( either Mariadb or mysql ) and then run a few scripts to get a planeshift user account set up along with some needed data.
When you run the new unreal server ( make target is: MyProject2Server ), it will attempt to connect to the DB. If successful, you will see something like this in the shell that you ran it from:
[2015.05.02-08.25.58:359][ 0]LogWorld: Bringing up level for play took: 0.000330
[2015.05.02-08.25.58:359][ 0]LogTemp:Warning: Hello world! BEFORE
[2015.05.02-08.25.58:359][ 0]LogTemp: Hello world! AFTER 4 5
[2015.05.02-08.25.58:371][ 0]LOG_STARTUP:Display: Database Host: 'localhost' User: 'planeshift' Databasename: 'planeshift' Port: 128880496
[2015.05.02-08.25.58:559][ 0]LOG_STARTUP:Display: Started Database with version: 1279
You can also check to see if the server connected to your mysql or mariadb server by making a simple script
SELECT SUBSTRING_INDEX(host, ':', 1) AS host_short,
GROUP_CONCAT(DISTINCT USER) AS users,
COUNT(*)
FROM information_schema.processlist
GROUP BY host_short
ORDER BY COUNT(*),
host_short;
Save this to a file called show_connected.sql and then log into the db and run it from there.
$ mysql -u root -pMYSECRETPASSWORD
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 51
Server version: 5.5.41-MariaDB-1ubuntu0.14.10.1 (Ubuntu)
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB $ \. show_connected.sql
+------------+-----------------+----------+
| host_short | users | COUNT(*) |
+------------+-----------------+----------+
| localhost | planeshift,root | 2 |
+------------+-----------------+----------+
1 row in set (0.03 sec)
cmake command for libzip
mkdir build cd build >cmake -DZLIB_LIBRARY=/home/planeshift/UnrealEngine/Engine/Source/ThirdParty/zlib/v1.2.8/lib/Linux/x86_64-unknown-linux-gnu/libz_fPIC.a -DZLIB_INCLUDE_DIR=/home/planeshift/UnrealEngine/Engine/Source/ThirdParty/zlib/v1.2.8/include/Linux/x86_64-unknown-linux-gnu/ -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DENABLE_WINDOWS_CRYPTO=OFF -DENABLE_BZIP2=OFF -DENABLE_LZMA=OFF ..
build xdelta
cd xdelta/xdelta3 rm -rf build mkdir build cd build
I had to add -fPIC to this line:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -DSIZEOF_SIZE_T=8 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8")
cmake .. cmake --build .