NDEthos
NDEthos

Reputation: 516

Qt Creator compile error "cannot find -lGL". Other solutions are not working

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.

Upvotes: 2

Views: 2478

Answers (2)

NDEthos
NDEthos

Reputation: 516

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.

Upvotes: 1

Nithish
Nithish

Reputation: 1640

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.

Upvotes: 2

Related Questions