aswf-docker icon indicating copy to clipboard operation
aswf-docker copied to clipboard

Qt5Gui CMake config error

Open glevner opened this issue 4 years ago • 2 comments

Re: VFX Platform 2020, Qt 5.12.6.

The Qt5GuiConfigExtras.cmake file generated by aswf-docker looks for libGL.so in /usr/local/lib64. So if you try to build an executable or library based on Qt5Gui on a host where the library is installed in /usr/lib64, for example, cmake configuration fails.

An easy kludge would be to patch the cmake file, replacing /usr/local/lib64/libGL.so with just libGL.so. But there may be a cleaner solution, and the problem may be corrected in more recent versions of Qt...?

glevner avatar Jan 15 '21 10:01 glevner

The problem persists in Qt 5.12.10.

glevner avatar Jan 15 '21 16:01 glevner

This isn't pretty, but the following patch to build_qt.sh fixes the problem for us:

diff --git a/scripts/base/build_qt.sh b/scripts/base/build_qt.sh
index 5fcb34a..da05241 100755
--- a/scripts/base/build_qt.sh
+++ b/scripts/base/build_qt.sh
@@ -48,6 +48,31 @@ fi
         -no-use-gold-linker
 make -j$(nproc)
 
+# Kludge to fix cmake config file containing the absolute path of libGL.so,
+# which breaks the building of targets against Qt5Gui on hosts where the GL
+# library lives somewhere else.
+#
+# See https://github.com/AcademySoftwareFoundation/aswf-docker/issues/103
+
+if [[ $ASWF_QT_VERSION == 5.12* ]]; then
+cd qtbase/lib/cmake/Qt5Gui
+cat <<EOF | patch
+diff -u Qt5GuiConfigExtras.cmake Qt5GuiConfigExtras-patched.cmake 
+--- Qt5GuiConfigExtras.cmake	2021-01-18 12:31:00.173398319 +0000
++++ Qt5GuiConfigExtras-patched.cmake	2021-01-18 13:07:37.304713921 +0000
+@@ -65,7 +65,7 @@
+ 
+ 
+ 
+-_qt5gui_find_extra_libs(OPENGL "/usr/local/lib64/libGL.so" "" "")
++_qt5gui_find_extra_libs(OPENGL "libGL.so" "" "")
+ 
+ 
+ 
+EOF
+cd ../../../..
+fi
+
 sudo make install
 
 cd ../..

glevner avatar Jan 18 '21 16:01 glevner