Oculus SDK does not support Linux. That statement is true. Thus, it appears that any project for Oculus Quest has to be at least deployed on Windows. Well, it turns out it doesn’t, if done through Unreal Engine (according to Google, it’s also doable with Unity Engine).
This realisation is probably going to save me from a large thorn in my side. Windows is not particularly development friendly and its main compiler, Visual Studio, is not very compliant to the C++ standard and outputs useless error messages when something is wrong way too often.
How to set up Unreal to work with Oculus Quest on Ubuntu (20.04 LTS)
The bad news is that it doesn’t work out of the box. The good news is that fixing it doesn’t need any specialised skills.
Here is a short summary how to do it with minimum improvisation.
The first step is, obviously, to install Unreal Editor. An installation guide is here for example. It’s nicely automated and works out of the box. Some steps take hours, though. The first launch is also extremely lengthy. The
make command automatically uses all hardware threads and the
-j argument shouldn’t be used. The whole compiled editor takes as much as 100 GiB of disk space.
The next step is to install Android SDK. Unreal comes with an installer that can install some of it. It installs everything needed on Windows, but it’s not as useful on Linux. It’s located in the Unreal folder in
Engine/Extras/AndroidWorks/Linux. It cannot run without
libpng12-0, with is obsolete and not available from Ubuntu repositories. A fix can be found here (I recommend using their backport). I am not sure if this is required by the actual program and not only by the installer.
It installs a wrong version of Android NDK, 12b, while 14b is needed. That version is old and no longer supported, but it can be downloaded from here (you will have to scroll down that page). It also doesn’t install OpenJDK8, but it can be installed using apt (package name is
openjdk-8-jdk). Also, the toolchain will not run without installing the
libncurses5 package (which is obsolete in more recent versions of Ubuntu, but available through apt).
At this point, this guide to create and configure a project can be used. For step 10, it seems to be necessary to set the paths to Java, Android SDK and Android NDK manually and set all versions to latest. Although the path to the tools will differ, it should look somewhat like the following picture:
The installed sets up a buggy version of ADB (program for connecting to Android devices). It can see the device, but it will not ask the Android device for permissions. Using the ADB from the official Ubuntu repo fixes the problem.
If the official guide with these changes is followed, it should be able to run the VR project to Oculus Quest and get its console output.
Be prepared that it takes very long to set all things up for the first time and consumes many gigabytes of disk space with intermediate files. It took over an hour on my hexacore processor and will take a minute or two when only small changes were made.
The Android compilation may fail when some of the compiler’s own dependencies are missing. It reports what
.so file is missing and it has to be manually installed. I missed only
libncurses-5, but I may have had other extra dependencies installed for various projects.
I also had an issue that I saw only black screen in VR. This was caused by updating the dependencies of Unreal Editor. Because the compilation script could not notice it was out of date, I had to delete it and compile it again.
The launcher does not inform you in any way that you should put the headset on. It simply stops at one command and eats 100% of one CPU. If this happens, simply put the headset on and launch the game from Uknown Sources if it doesn’t launch the automatically.