PDA

View Full Version : collect2: error: ld returned 1 exit status



tndave
15th July 2018, 15:47
Good morning,

I am having issues with the above error when trying to compile the app I am working on. I have the full error below, but just want to give a little background. I am running a fresh install of Ubuntu 18.04, Gnome Desktop, 4gb memory, Core i5 processor. This error is basically immediate, I create a new project and name it. Once creator opens the files for editing I don't do anything but save and then select the option to build. Soon as I do that I get the following....


moc_mainwindow.o moc_mainwindow.cpp
g++ -Wl,-rpath,/home/david/Qt/5.11.1/gcc_64/lib -o SimpleNote main.o mainwindow.o moc_mainwindow.o -L/home/david/Qt/5.11.1/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
/usr/bin/x86_64-linux-gnu-ld: cannot find -lGL
Makefile:257: recipe for target 'SimpleNote' failed
collect2: error: ld returned 1 exit status
make: *** [SimpleNote] Error 1
09:32:20: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project SimpleNote (kit: Desktop Qt 5.11.1 GCC 64bit)
When executing step "Make"

I have not changed or added anything to the project as of yet. Just fresh creation of a new project and then build/run. Any ideas on what may be causing the problem? I didn't have this issue when I was running Kubuntu or Manjaro.

Many thanks :)

tndave
15th July 2018, 18:18
Found the fix already, listing it below...

If running ubuntu have to install


sudo apt-get install libgl-dev libglu-dev

and possibly..


sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev

After doing this my app now builds fine.

Actually found this information in QT Creator under help section > FAQ.

Hope this helps others as well :)