Solved Can't build chip example - /usr/bin/ld: cannot find -lGL
-
Hello.
I just installed CentOS Linux release 7.5.1804, Qt 4.8.7 using yum (base repo) and Qt Creator 4.6.1 using online installer.
I have NVIDIA video card on may notebook and I installed NVIDIA driver.
Demo applications, those are provided with Qt in binary form, work fine - chip for example - and OpenGL is supported.
But when I try to build it (chip example), I get the following linker error:g++ -o chip main.o mainwindow.o view.o chip.o moc_mainwindow.o moc_view.o qrc_images.o -L/usr/lib64 -L/usr/X11R6/lib -lQtOpenGL -lQtGui -lQtCore -lGL -lpthread /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so when searching for -lGL /usr/bin/ld: skipping incompatible //lib/libGL.so when searching for -lGL /usr/bin/ld: skipping incompatible //usr/lib/libGL.so when searching for -lGL /usr/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status
I have libGL.so in /usr/lib64, I have mesa-libGL and mesa-libGL-devel packages installed.
How to solve the problem? -
Hi,
Might be a silly question but are you sure you are building your application in 64bit ?
-
@SGaist said in Can't build chip example - /usr/bin/ld: cannot find -lGL:
Hi,
Might be a silly question but are you sure you are building your application in 64bit ?
Hi @SGaist, thanks for the reply first.
I don't think your question is silly - I was also thinking about that when I saw the paths where ld was searching the lib, but ...
I uninstalled NVIDIA driver, screen resolution on my notebook is ugly now, but chip example is compiled and linked without any errors! And when I run the chip example OpenGL is supported!
As far as I understand, installation of NVIDIA video card driver breaks ... something in ... somewhere :) But I have no idea what and where, and how to fix it :(
Maybe you know the way how to tell Qt to use NVIDIA driver, or OpenGL lib, or ... something to fix the problem?
Thanks in advance for answering. -
How did you install the Nvidia stuff ?
-
@SGaist
I install NVIDIA driver by compiling it - I must have kernel-headers and kernel-devel packages installed. Installation is done by root on level 3 - X is not running. I installed NVIDIA driver before Qt installation. -
What about the associated OpenGL libraries ?
-
Here are the libs:
[user@centos-7 ~]$ ls -h /usr/lib64/ | grep "libGL" libGLdispatch.so.0 libGLESv1_CM_nvidia.so.1 libGLESv1_CM_nvidia.so.390.59 libGLESv1_CM.so libGLESv1_CM.so.1 libGLESv1_CM.so.1.2.0 libGLESv2_nvidia.so.2 libGLESv2_nvidia.so.390.59 libGLESv2.so libGLESv2.so.2 libGLESv2.so.2.1.0 libGL.la libGL.so libGL.so.1 libGL.so.1.7.0 libGLU.so libGLU.so.1 libGLU.so.1.3.1 libGLX_indirect.so.0 libGLX_nvidia.so.0 libGLX_nvidia.so.390.59 libGLX.so libGLX.so.0
Do you mean anything else?
-
How did you instal them ?
-
The problem is solved - I install NVIDIA the latest driver (version: 390.67 release Date: 2018.6.5) in this way: http://www.advancedclustering.com/act_kb/installing-nvidia-drivers-rhel-centos-7/.
-
@SGaist said in Can't build chip example - /usr/bin/ld: cannot find -lGL:
How did you instal them ?
I download shell script from NVIDIA and started it in terminal.
The problem is solved by installing the latest NVIDIA drivers (version: 390.67 release Date: 2018.6.5) in that way: http://www.advancedclustering.com/act_kb/installing-nvidia-drivers-rhel-centos-7/.
-
Glad you found out and thanks for sharing !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)