Wednesday, July 22, 2020

fixing error :- /usr/bin/ld: cannot find -lGL in Qt


after installing of Qt5.7 and building a simple "hello word" gui project  if you encounter following error :-

    20:38:00: Running steps for project untitled...
    20:38:00: Starting: "/opt/Qt/5.7/gcc_64/bin/qmake" /opt/project/qt/untitled/untitled.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
    Info: creating stash file /opt/project/qt/build-untitled-Desktop_Qt_5_7_0_GCC_64bit-Debug/.qmake.stash
    20:38:00: The process "/opt/Qt/5.7/gcc_64/bin/qmake" exited normally.
    20:38:00: Starting: "/usr/bin/make"
    /opt/Qt/5.7/gcc_64/bin/uic ../untitled/mainwindow.ui -o ui_mainwindow.h
    g++ -c -pipe -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../untitled -I. -I../../../Qt/5.7/gcc_64/include -I../../../Qt/5.7/gcc_64/include/QtWidgets -I../../../Qt/5.7/gcc_64/include/QtGui -I../../../Qt/5.7/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.7/gcc_64/mkspecs/linux-g++ -o main.o ../untitled/main.cpp
    g++ -c -pipe -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../untitled -I. -I../../../Qt/5.7/gcc_64/include -I../../../Qt/5.7/gcc_64/include/QtWidgets -I../../../Qt/5.7/gcc_64/include/QtGui -I../../../Qt/5.7/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.7/gcc_64/mkspecs/linux-g++ -o mainwindow.o ../untitled/mainwindow.cpp
    /opt/Qt/5.7/gcc_64/bin/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/Qt/5.7/gcc_64/mkspecs/linux-g++ -I/opt/project/qt/untitled -I/opt/Qt/5.7/gcc_64/include -I/opt/Qt/5.7/gcc_64/include/QtWidgets -I/opt/Qt/5.7/gcc_64/include/QtGui -I/opt/Qt/5.7/gcc_64/include/QtCore -I. -I/usr/include/c++/4.8.5 -I/usr/include/c++/4.8.5/x86_64-redhat-linux -I/usr/include/c++/4.8.5/backward -I/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I/usr/local/include -I/usr/include ../untitled/mainwindow.h -o moc_mainwindow.cpp
    g++ -c -pipe -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../untitled -I. -I../../../Qt/5.7/gcc_64/include -I../../../Qt/5.7/gcc_64/include/QtWidgets -I../../../Qt/5.7/gcc_64/include/QtGui -I../../../Qt/5.7/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.7/gcc_64/mkspecs/linux-g++ -o moc_mainwindow.o moc_mainwindow.cpp
    g++ -Wl,-rpath,/opt/Qt/5.7/gcc_64/lib -o untitled main.o mainwindow.o moc_mainwindow.o   -L/opt/Qt/5.7/gcc_64/lib -lQt5Widgets -L/usr/lib64 -lQt5Gui -lQt5Core -lGL -lpthread
    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status
    make: *** [untitled] Error 1
    20:38:02: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project untitled (kit: Desktop Qt 5.7.0 GCC 64bit)
    When executing step "Make"
    20:38:02: Elapsed time: 00:02.


then
for this you need to install following rpms :-

    expat-2.1.0-10.el7_3.i686.rpm
    expat-2.1.0-10.el7_3.x86_64.rpm
    expat-devel-2.1.0-10.el7_3.i686.rpm
    expat-devel-2.1.0-10.el7_3.x86_64.rpm
    expat-static-2.1.0-10.el7_3.i686.rpm
    expat-static-2.1.0-10.el7_3.x86_64.rpm
    gl-manpages-1.1-7.20130122.el7.noarch.rpm
    libdrm-2.4.83-2.el7.i686.rpm
    libdrm-2.4.83-2.el7.x86_64.rpm
    libdrm-devel-2.4.83-2.el7.i686.rpm
    libdrm-devel-2.4.83-2.el7.x86_64.rpm
    libglvnd-1.0.1-0.8.git5baa1e5.el7.i686.rpm
    libglvnd-glx-1.0.1-0.8.git5baa1e5.el7.i686.rpm
    libpciaccess-0.14-1.el7.i686.rpm
    libpciaccess-0.14-1.el7.x86_64.rpm
    libpciaccess-devel-0.14-1.el7.i686.rpm
    libpciaccess-devel-0.14-1.el7.x86_64.rpm
    libselinux-2.5-12.el7.i686.rpm
    libselinux-2.5-12.el7.x86_64.rpm
    libsepol-2.5-8.1.el7.i686.rpm
    libsepol-2.5-8.1.el7.x86_64.rpm
    libsepol-devel-2.5-8.1.el7.i686.rpm
    libsepol-devel-2.5-8.1.el7.x86_64.rpm
    libX11-1.6.5-1.el7.i686.rpm
    libX11-1.6.5-1.el7.x86_64.rpm
    libX11-common-1.6.5-1.el7.noarch.rpm
    libX11-devel-1.6.5-1.el7.i686.rpm
    libX11-devel-1.6.5-1.el7.x86_64.rpm
    libXau-1.0.8-2.1.el7.i686.rpm
    libXau-1.0.8-2.1.el7.x86_64.rpm
    libXau-devel-1.0.8-2.1.el7.i686.rpm
    libXau-devel-1.0.8-2.1.el7.x86_64.rpm
    libxcb-1.12-1.el7.i686.rpm
    libxcb-1.12-1.el7.x86_64.rpm
    libxcb-devel-1.12-1.el7.i686.rpm
    libxcb-devel-1.12-1.el7.x86_64.rpm
    libXdamage-1.1.4-4.1.el7.i686.rpm
    libXdamage-1.1.4-4.1.el7.x86_64.rpm
    libXdamage-devel-1.1.4-4.1.el7.i686.rpm
    libXdamage-devel-1.1.4-4.1.el7.x86_64.rpm
    libXext-1.3.3-3.el7.i686.rpm
    libXext-1.3.3-3.el7.x86_64.rpm
    libXext-devel-1.3.3-3.el7.i686.rpm
    libXext-devel-1.3.3-3.el7.x86_64.rpm
    libXfixes-5.0.3-1.el7.i686.rpm
    libXfixes-5.0.3-1.el7.x86_64.rpm
    libXfixes-devel-5.0.3-1.el7.i686.rpm
    libXfixes-devel-5.0.3-1.el7.x86_64.rpm
    libxshmfence-1.2-1.el7.i686.rpm
    libxshmfence-1.2-1.el7.x86_64.rpm
    libxshmfence-devel-1.2-1.el7.i686.rpm
    libxshmfence-devel-1.2-1.el7.x86_64.rpm
    libXxf86vm-1.1.4-1.el7.i686.rpm
    libXxf86vm-1.1.4-1.el7.x86_64.rpm
    libXxf86vm-devel-1.1.4-1.el7.i686.rpm
    libXxf86vm-devel-1.1.4-1.el7.x86_64.rpm
    mesa-libGL-18.0.5-3.el7.i686.rpm
    mesa-libglapi-18.0.5-3.el7.i686.rpm
    mesa-libglapi-18.0.5-3.el7.x86_64.rpm
    mesa-libGL-devel-17.2.3-8.20171019.el7.i686.rpm
    mesa-libGL-devel-17.2.3-8.20171019.el7.x86_64.rpm
    mesa-libGLU-9.0.0-4.el7.i686.rpm
    mesa-libGLU-9.0.0-4.el7.x86_64.rpm
    mesa-libGLU-devel-9.0.0-4.el7.i686.rpm
    mesa-libGLU-devel-9.0.0-4.el7.x86_64.rpm
    pcre2-10.23-2.el7.i686.rpm
    pcre2-10.23-2.el7.x86_64.rpm
    pcre2-devel-10.23-2.el7.i686.rpm
    pcre2-devel-10.23-2.el7.x86_64.rpm
    pcre2-utf16-10.23-2.el7.i686.rpm
    pcre2-utf16-10.23-2.el7.x86_64.rpm
    pcre2-utf32-10.23-2.el7.i686.rpm
    pcre2-utf32-10.23-2.el7.x86_64.rpm
    pcre-8.32-17.el7.i686.rpm
    pcre-8.32-17.el7.x86_64.rpm
    pcre-devel-8.32-17.el7.i686.rpm



don't warry all of these will be found in centos7.5 everything dvd.
then compile again and run . you will get running program.

No comments:

Post a Comment