Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Building 32-bit app under 64-bit Ubuntu - Cannot find -lGL ( OpenGL) even though added to lib path ?
QtWS25 Last Chance

[Solved] Building 32-bit app under 64-bit Ubuntu - Cannot find -lGL ( OpenGL) even though added to lib path ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 9.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EdOfTheMountain
    wrote on last edited by
    #1
    • I have both 32 and 64 bit Qt 5.3.1 installed under Ubuntu 64-bit.
    • I can build a 64-bit Qt app no problems
    • I installed 32-bit mesa and many other dependencies in order to install 32-bit Qt
    • I added "-m32" and GL lib path to qmake project file
    • 32-bit Qt apps compile but cannot link with GL
    • The following link error occurs when building for Desktop Qt 5.3 GCC 32bit:
      @
      /usr/bin/ld: cannot find -lGL
      @

    Is this a lib path order problem? What am I not seeing?

    File: Qt Project
    @
    QT += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = trash-widget
    TEMPLATE = app

    Ubuntu x64: x86_64

    message(QMAKE_HOST.arch = $$QMAKE_HOST.arch)

    GCC 32-bi: i386

    GCC 64-bit: x86_64

    message(QT_ARCH = $${QT_ARCH})

    equals(QT_ARCH, "i386") {
    TARGET = $${TARGET}x32
    QMAKE_CXXFLAGS += -m32

    # GL was installed here:
    # /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
    LIBS += -L/usr/lib/i386-linux-gnu/mesa
    

    } equals(QT_ARCH, "x86_64") {
    TARGET = $${TARGET}x64
    }

    SOURCES += main.cpp
    mainwindow.cpp
    HEADERS += mainwindow.h
    FORMS += mainwindow.ui
    @

    Compiler Output: "/usr/bin/ld: cannot find -lGL"
    @
    g++ -m32 -Wl,-rpath,/opt/Qt5.3.1-x32/5.3/gcc -Wl,-rpath,/opt/Qt5.3.1-x32/5.3/gcc/lib -o trash-widgetx32 main.o mainwindow.o moc_mainwindow.o -L/usr/lib/i386-linux-gnu/mesa -L/opt/Qt5.3.1-x32/5.3/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status
    make: *** [trash-widgetx32] Error 1
    14:25:03: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project trash-widget (kit: Desktop Qt 5.3 GCC 32bit)
    When executing step 'Make'
    14:25:03: Elapsed time: 00:03.
    @

    Thanks in advance,

    -Ed

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you install the OpenGL dev package ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • E Offline
        E Offline
        EdOfTheMountain
        wrote on last edited by
        #3

        Thank you! That was it. I can now build either 32 or 64 bit Qt apps.

        I installed these two packages. I am not sure if I needed mesa-common-dev but once I installed libglu1-mesa-dev:i386 all was good!
        @
        sudo apt-get install mesa-common-dev:i386
        sudo apt-get install libglu1-mesa-dev:i386
        @

        I had them in my development environment notes but somehow missed installing. I need to make a script or a kickstart.

        Thanks again,

        -Ed

        1 Reply Last reply
        0
        • E Offline
          E Offline
          EdOfTheMountain
          wrote on last edited by
          #4

          Under Ubuntu 14.04 64-bit,

          I added these packages in order to install Qt 5.3.1 32-bit and build 32-bit apps under 64-bit Ubuntu.

          @
          sudo apt-get install \

          Qt: deps \

          libsm6:i386
          libxrender1:i386
          libfontconfig1:i386
          libxext6:i386
          libgtk2.0-0:i386
          libcanberra-gtk-module:i386
          libxslt1.1:i386
          libglu1-mesa-dev:i386
          libc6-i386
          libglib2.0-0:i386
          libsm6:i386
          libglu1-mesa:i386
          libgl1-mesa-glx:i386
          libxext6:i386
          libxrender1:i386
          libx11-6:i386
          libfontconfig1:i386
          lsb-core
          g++-multilib \

          Qt Creator Deps: \

          libgstreamer0.10-0:i386
          libgstreamer-plugins-base0.10-0:i386

          Install 32-bit Qt:
          chmod +x qt-opensource-linux-x86-android-5.3.1.run
          ./qt-opensource-linux-x86-android-5.3.1.run
          @

          I used sudo to run the Qt installers and installed each Qt to it's own folder:

          • /opt/Qt5.3.1-x32
          • /opt/Qt5.3.1-x64

          Then I launched 64-bit Qt Creator and configures a 32 bit Qt version, then cloned the 64-bit build kit and renamed it to 32-bit and made it point to the 32bit Qt version.

          I suspect there may be better solutions to install 32 and 64 bit Qt that do not use as much disk space but this approach works and does not make my brain hurt too much. ;-)

          -Ed

          1 Reply Last reply
          0
          • E Offline
            E Offline
            EdOfTheMountain
            wrote on last edited by
            #5

            Apparently OpenGL 32 and 64 bit packages remove and replace each other under 64-bit Ubuntu and last package installed wins.

            • https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/949606
            • https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1246013
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved