Results 1 to 19 of 19

Thread: Error: /usr/bin/ld: cannot find -lGL

  1. #1
    Join Date
    Mar 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Error: /usr/bin/ld: cannot find -lGL

    I installed latest Qt 5 for Linux and tried to test by simply dragging and dropping a pushbutton and build. But it throws an error. I didn't get any idea. Here's the compile output:

    11:54:57: Running steps for project Test...
    11:54:57: Starting: "/usr/bin/make" clean -w
    make: Entering directory `/home/tom/Data/Qt5/Test-build-Desktop_Qt_5_0_0_GCC_32bit_SDK-Debug'
    rm -f moc_widget.cpp
    rm -f ui_widget.h
    rm -f main.o widget.o moc_widget.o
    rm -f *~ core *.core
    make: Leaving directory `/home/tom/Data/Qt5/Test-build-Desktop_Qt_5_0_0_GCC_32bit_SDK-Debug'
    11:54:57: The process "/usr/bin/make" exited normally.
    11:54:57: Configuration unchanged, skipping qmake step.
    11:54:57: Starting: "/usr/bin/make" -w
    make: Entering directory `/home/tom/Data/Qt5/Test-build-Desktop_Qt_5_0_0_GCC_32bit_SDK-Debug'
    /home/tom/Programs/Qt/5.0.0/gcc/bin/uic ../Test/widget.ui -o ui_widget.h
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../Programs/Qt/5.0.0/gcc/mkspecs/linux-g++ -I../Test -I../../../Programs/Qt/5.0.0/gcc/include -I../../../Programs/Qt/5.0.0/gcc/include/QtWidgets -I../../../Programs/Qt/5.0.0/gcc/include/QtGui -I../../../Programs/Qt/5.0.0/gcc/include/QtCore -I. -I. -I. -o main.o ../Test/main.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../Programs/Qt/5.0.0/gcc/mkspecs/linux-g++ -I../Test -I../../../Programs/Qt/5.0.0/gcc/include -I../../../Programs/Qt/5.0.0/gcc/include/QtWidgets -I../../../Programs/Qt/5.0.0/gcc/include/QtGui -I../../../Programs/Qt/5.0.0/gcc/include/QtCore -I. -I. -I. -o widget.o ../Test/widget.cpp
    /home/tom/Programs/Qt/5.0.0/gcc/bin/moc -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../Programs/Qt/5.0.0/gcc/mkspecs/linux-g++ -I../Test -I../../../Programs/Qt/5.0.0/gcc/include -I../../../Programs/Qt/5.0.0/gcc/include/QtWidgets -I../../../Programs/Qt/5.0.0/gcc/include/QtGui -I../../../Programs/Qt/5.0.0/gcc/include/QtCore -I. -I. -I. ../Test/widget.h -o moc_widget.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../Programs/Qt/5.0.0/gcc/mkspecs/linux-g++ -I../Test -I../../../Programs/Qt/5.0.0/gcc/include -I../../../Programs/Qt/5.0.0/gcc/include/QtWidgets -I../../../Programs/Qt/5.0.0/gcc/include/QtGui -I../../../Programs/Qt/5.0.0/gcc/include/QtCore -I. -I. -I. -o moc_widget.o moc_widget.cpp
    g++ -Wl,-rpath,/home/tom/Programs/Qt/5.0.0/gcc -Wl,-rpath,/home/tom/Programs/Qt/5.0.0/gcc/lib -o Test main.o widget.o moc_widget.o -L/home/tom/Programs/Qt/5.0.0/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    /usr/bin/ld: cannot find -lGL
    make: Leaving directory `/home/tom/Data/Qt5/Test-build-Desktop_Qt_5_0_0_GCC_32bit_SDK-Debug'
    collect2: ld returned 1 exit status
    make: *** [Test] Error 1
    11:55:00: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project Test (kit: Desktop Qt 5.0.0 GCC 32bit (SDK))
    When executing step 'Make'

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    take the GL dependency out of your pro file
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Mar 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by amleto View Post
    take the GL dependency out of your pro file
    Could you please tell how do I do that? I'm a newbie.

  4. #4
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Add in pro file LIBS += -lGL

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by tomkonikkara View Post
    Could you please tell how do I do that? I'm a newbie.
    Somewhere in your project file there is something similar to:

    qmake Code:
    1. QT += opengl
    To copy to clipboard, switch view to plain text mode 

    Remove it and rerun qmake.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Mar 2011
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    I tried both, but still not works.

    This is my pro file:

    #-------------------------------------------------
    #
    # Project created by QtCreator 2012-12-25T10:45:20
    #
    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = Test
    TEMPLATE = app


    SOURCES += main.cpp\
    widget.cpp

    HEADERS += widget.h

    FORMS += widget.ui

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    It seems that by default QtWidgets requires OpenGL. In that case do you have OpenGL installed? Can you find a file called libGL.so in your system?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Hi i have some problem my .pro
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2012-12-27T13:59:39
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui
    8.  
    9. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    10.  
    11. TARGET = untitled1
    12. TEMPLATE = app
    13.  
    14.  
    15. SOURCES += main.cpp\
    16. mainwindow.cpp
    17.  
    18. HEADERS += mainwindow.h
    19.  
    20. FORMS += mainwindow.ui
    To copy to clipboard, switch view to plain text mode 
    ANd i have in system
    libGL.so.1 and libGL.so.1.2.0
    System: Linux Ubuntu 12.10

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    And why are you trying to hijack this thread instead of starting your own?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Because author has same problems and he hasn't written nothing about 2 days.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    We don't know if he has the same problem. You didn't even state what your problem was.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by Viper666 View Post
    ANd i have in system
    libGL.so.1 and libGL.so.1.2.0
    System: Linux Ubuntu 12.10
    BTW. You need libGL.so, not libGL.so.1. One should be a symlink to the other though (try running ldconfig as root and see if the link gets created).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    81
    Thanks
    6
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    same problem using a fresh qt5 linux install.

    I resolve this problem delete the -lGL option in the makefile generated in qmake. whis is a workaround but dor the moment works for me.

    just search the -lGL option in Makefile and delete the text.

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by ecanela View Post
    same problem using a fresh qt5 linux install.
    This is not about Qt5. It is your system that is missing a library it is supposed to have. Reinstalling Qt won't help here. You need to install libmesa or accelerated NVIDIA drivers (in case you're using a NVIDIA card).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Oct 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Hello, I'm finded this problem on lubuntu 13.04 with Qt 5.0.2 when trying to compile my project with widgets and QtWebKit.
    Solve this problem by writing command in terminal:
    Qt Code:
    1. sudo apt-get install libglu1-mesa-dev
    To copy to clipboard, switch view to plain text mode 

  16. #16
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by Hronom View Post
    Qt Code:
    1. sudo apt-get install libglu1-mesa-dev
    To copy to clipboard, switch view to plain text mode 
    Yes, every Ubuntu user needs to install this package before runnin opengl. This would have been very clear from the beginning if you had bothered to google the error..

  17. The following user says thank you to saman_artorious for this useful post:

    kid9591 (12th June 2013)

  18. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by saman_artorious View Post
    Yes, every Ubuntu user needs to install this package before runnin opengl.
    No, development packages are not required for running OpenGL.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. The following user says thank you to wysota for this useful post:


  20. #18
    Join Date
    Jan 2013
    Posts
    6
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by Hronom View Post
    Hello, I'm finded this problem on lubuntu 13.04 with Qt 5.0.2 when trying to compile my project with widgets and QtWebKit.
    Solve this problem by writing command in terminal:
    Qt Code:
    1. sudo apt-get install libglu1-mesa-dev
    To copy to clipboard, switch view to plain text mode 
    Wonderful, thank you. it works for me.

  21. #19
    Join Date
    Sep 2015
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Lightbulb Error: /usr/bin/ld: cannot find -lGL

    Quote Originally Posted by tomkonikkara View Post
    /usr/bin/ld: cannot find -lGL
    meaning the linker misses an OpenGL library.

    This happens on fresh installs QT 5.5 on mint 17.2 cinnamon, for example.

    I used synaptic-pack-installer to install

    libglfw-dev
    header files and static libraries portable framework for OpenGL application development

    and

    libglfw2
    Shared libraries portable framework for OpenGL application development


    and that causally fixed it. The wizard apps do build all of a sudden.

Similar Threads

  1. How to find the error in QNetworkReply?
    By Gokulnathvc in forum Newbie
    Replies: 13
    Last Post: 20th April 2012, 10:40
  2. cannot find -lqwtd error
    By mobucl in forum Qwt
    Replies: 5
    Last Post: 6th May 2011, 12:59
  3. error: cannot find -lovlnxlib
    By Tondog in forum KDE Forum
    Replies: 0
    Last Post: 14th August 2009, 15:20
  4. Find one error
    By BadKnees in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2009, 15:33
  5. The error: /usr/bin/ld: cannot find -lphonon
    By learning_qt in forum Qt Programming
    Replies: 1
    Last Post: 1st October 2008, 22:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.