HiFi Source Building Notes

From FHU Wiki
Jump to: navigation, search

 

 

Compiling on Ubuntu 19.04[edit]

Follow the main instructions here

Before running cmake edit hifi_vcpkg.py in the main repo and at line 264 add

   elif platform.linux_distribution()[1][:3] == '19.':
       url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz'

so your file should now look a bit like this

   elif platform.linux_distribution()[1][:3] == '18.':
       url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz'
   elif platform.linux_distribution()[1][:3] == '19.':
       url = 'https://hifi-public.s3.amazonaws.com/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz'
   else:
       print('UNKNOWN LINUX VERSION!!!')

and save. (qt file is just under 900mb so will take a few minutes to download go get a coffee)

Then go here (for 64bit, other versions here) and download the lib and install.

and then proceed with the rest of the original instructions!

This worked for me (Fluffy) <3

Thanks to Andrew (hifi dev) for his help on figuring this out!

Alternate vcpkg patch[edit]

diff --git a/hifi_vcpkg.py b/hifi_vcpkg.py
index 764a6270bd..8ab39b1324 100644
--- a/hifi_vcpkg.py
+++ b/hifi_vcpkg.py
@@ -218,6 +218,9 @@ endif()
         if self.args.android:
             precompiled = os.path.realpath(self.androidPackagePath)
             qt5InstallPath = os.path.realpath(os.path.join(precompiled, 'qt'))
+
+        qt5InstallPath = os.getenv('HIFI_QT5_PATH', qt5InstallPath)
+
         return qt5InstallPath
 
     def writeConfig(self):

This adds a new environment variable, @HIFI_QT5_PATH@ which can be used to tell vcpkg where a compiled and installed qt5 is. This will stop it from downloading a Qt archive, ensure it uses the provided path, and avoid any confusion that might arise regarding which Qt to use.

 

Notes on building the source code[edit]

 

 

Qt[edit]

The latest versions build and use their own Qt. vcpkg will only download versions for Ubuntu 16.04 and Ubuntu 18.04.

For building your own, the instructions are in repository

The GLX problem[edit]

The package for 16.04 as of writing is **broken** and will make interface fail with this message:

   QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
   Failed to create OffscreenGLCanvas context

When building on 16.04, following the instructions will result in the same problem as above. The issue is that Qt fails to find libX11.so, and goes ahead without using it. See the output of 'configure', if it shows "GLX Plugin" as "no" as seen below, you have this problem:

 

   QPA backends:
     DirectFB ............................... no
     EGLFS .................................. no
     LinuxFB ................................ yes
     VNC .................................... yes
     Mir client ............................. no
     XCB:
       Using system-provided XCB libraries .. no
       XCB XKB .............................. yes
       XCB XInput ........................... yes
       Native painting (experimental) ....... no
       GL integrations:
         GLX Plugin ......................... no  <---
         EGL-X11 Plugin ..................... no

 

The solution[edit]

The file qtbase/mkspecs/linux-g++-64/qmake.conf includes the following:

   QMAKE_LIBDIR_X11        = /usr/X11R6/lib64
   QMAKE_LIBDIR_OPENGL     = /usr/X11R6/lib64

There's no such path on Ubuntu 16.04. The libraries are instead in /usr/lib/x86_64-linux-gnu. I'm not sure yet if there's some sort of path autodetection that's failing, or Ubuntu 16.04 is just too old to be officially supported by Qt anymore. In any case, this can be fixed by changing those lines to:

   QMAKE_LIBDIR_X11        = /usr/lib/x86_64-linux-gnu
   QMAKE_LIBDIR_OPENGL     = /usr/lib/x86_64-linux-gnu

This can be easily scripted:

   sed -i -r 's/^QMAKE_LIBDIR_X11\\s*=.*$/QMAKE_LIBDIR_X11 = \/usr\/lib\/x86_64-linux-gnu/g'       qtbase/mkspecs/linux-g++-64/qmake.conf
   sed -i -r 's/^QMAKE_LIBDIR_OPENGL\\s*=.*$/QMAKE_LIBDIR_OPENGL = \/usr\/lib\/x86_64-linux-gnu/g' qtbase/mkspecs/linux-g++-64/qmake.conf