2

I have installed QT5 that also comes with QT creator on an amd machine running ubuntu 12.04. My grapics driver is a radeon r9270x if that matters.

When I try to compile a basic "hello world" type Qt program I get the error message "cannot find -lGL". I have searched around and here( Qt: can't find -lGL error ) it says to use "sudo apt-get install libgl1-mesa-dev" but when I do I already have that installed. Here ( Installing Qt on linux, cannot find -lGL ) it says to install "sudo apt-get install libgl-dev" but that only gets me

"Reading package lists... Done Building dependency tree Reading state information... Done Package libgl-dev is a virtual package provided by: libgl1-mesa-swx11-dev 8.0.4-0ubuntu0.7
libgl1-mesa-dev-lts-trusty 10.1.3-0ubuntu0.1~precise1
libgl1-mesa-dev-lts-saucy 9.2.1-1ubuntu3~precise1
libgl1-mesa-dev-lts-raring 9.1.7-1ubuntu2~precise1
libgl1-mesa-dev-lts-quantal 9.0.3-0ubuntu0.4~precise1
libgl1-mesa-dev 8.0.4-0ubuntu0.7 You should explicitly select one to install.

E: Package 'libgl-dev' has no installation candidate"

Various other resources that I have used say to do similar things but I get this error still. Any ideas? As a side not, not knowing the relevance, I could not get QT creator to launch for the longest time. It would always seg fault and core dump. I finally updated my amd catylist control center/video drivers and that fixed the problem.

Here is the compile output from qt creator:

02:34:21: Running steps for project myHelloWorld... 02:34:21: Configuration unchanged, skipping qmake step. 02:34:21: Starting: "/usr/bin/make" g++ -Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64 -Wl,-rpath,/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -o myHelloWorld main.o
-L/media/UsbExternalDrive/DesignTools/Qt5.3/5.3/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread /usr/bin/ld: cannot find -lGL collect2: ld returned 1 exit status make: *** [myHelloWorld] Error 1 02:34:21: The process "/usr/bin/make" exited with code 2. Error while building/deploying project myHelloWorld (kit: Desktop Qt 5.3 GCC 64bit) When executing step "Make" 02:34:21: Elapsed time: 00:00.

Community
  • 1
  • 1
NDEthos
  • 507
  • 6
  • 17

2 Answers2

2

Try running this, restart Qt creator and try a clean build.

sudo apt-get install mesa-common-dev

EDIT: Could be that you just miss Mesa package. Take a look at XCB dependencies listed here and install what’s missing.

I’ve seen this error also mentioned in a different case, but I don’t remember the solution there. I think I had solved the problem by installing the “libglu1-mesa-dev” package.

sudo apt-get install libglu1-mesa-dev -y

But I am not entirely sure if just this had fixed the issue or I had to install anything else.

Nithish
  • 1,580
  • 12
  • 21
  • Closed QT creator. Ran the above command. It did nothing because these components are already installed. Restarted QT Creator and tried to compile the project again and got the same error. – NDEthos Oct 18 '14 at 06:35
  • Running "sudo apt-get install libglu1-mesa-dev -y" installs nothing as all the components are already installed. As for your link the xcb stuff for ubuntu reqires this " sudo apt-get install "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev" and it installs nothing because everything is already installed. – NDEthos Oct 18 '14 at 06:55
  • Did you check the link to a Qt page I put in my answer? – Nithish Oct 18 '14 at 06:56
  • Hmmm... This issue looks interesting. – Nithish Oct 18 '14 at 06:59
  • Can you post your actual compile command line so I can see the link parameters? – Nithish Oct 18 '14 at 07:32
  • Since you say you have the radeon drivers, try making a symbolic link. Something link `sudo ln -s /usr/lib/radeon-r9270x/libGL.so /usr/lib/libGL.so`. The path I used is based on a guess. Make sure you use the right path. – Nithish Oct 18 '14 at 07:37
  • While there may be an issue with the linking of libGL.so from /user/lib or /user/local/lib, the library needed to link to should not be specific to a video card. That would make a compiled program to specific for a computer setup right? – NDEthos Oct 18 '14 at 07:42
  • You are right. But I was just trying to exactly find out where the problem is, so that your search for a solution would be easier. – Nithish Oct 18 '14 at 07:45
  • I am going to try creating a GL sym ling that links to /usr/lib/x86_64-linux-gnu/libGLU.so which is the opengl utility mesa thing. – NDEthos Oct 18 '14 at 07:47
1

So what I found worked for me, I manual added the path to the library and compiled. Then I was able to remove the manually added path. I assume somewhere on the backend it was not searching the correct place and once it was shown it remembered and kept the correct location.

NDEthos
  • 507
  • 6
  • 17