Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qmake cannot find libraries
Forum Updated to NodeBB v4.3 + New Features

Qmake cannot find libraries

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
linuxpkg-configqt creatorlibraries
4 Posts 3 Posters 4.7k Views 3 Watching
  • 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.
  • D Offline
    D Offline
    dhaus
    wrote on 21 Jan 2022, 04:35 last edited by
    #1

    I am using Qt Creator 6.0.1 on linux (Cinnamon). I previously compiled and ran the same project without any issues, just using g++ and linking to the same libraries with pkg-config. I now want to use Qt just to make a GUI for my program.

    I am unable to link 2 system libraries for my project in Qt Creator. No matter how I try to link them, qmake fails to build because it cannot find them. First, I tried using pkg-config by adding the following to my .pro file:

        QT_CONFIG -= no-pkg-config
        CONFIG += link_pkgconfig
        PKG_CONFIG_PATH=:/usr/lib/x86_64-linux-gnu/pkgconfig
        PKGCONFIG += sndfile
        PKGCONFIG += jack
        PKGCONFIG += soundtouch
    

    But I just get a "jack development package not found" error message and it doesn't compile. Strangely, it finds sndfile, but not the other two. Also, it cannot find the system header files that I refer to, even if I explicitly put the full path from root in quotation marks. To troubleshoot, I tried using LIBS+=... and INCLUDEPATH+=... instead of pkg-config, but that didn't work either.

    So then, just to get it to compile, I tried manually adding each library .so file using right-click "Add Library", but in the file browser that pops up, many of the libraries in my /usr/lib/x86_64-linux-gnu/ folder are simply not there! (I can clearly see them when I use the file manager). It seems to me that the problem is that for some reason certain files in the root directory are invisible to Qt Creator and qmake. If I copy these same files to my project folder in the home directory and try to add them there, I can add them just fine. Same story with the header files in usr/include/.

    Does anyone know why this might be happening and how to fix it?

    C 1 Reply Last reply 21 Jan 2022, 15:26
    0
    • D dhaus
      21 Jan 2022, 04:35

      I am using Qt Creator 6.0.1 on linux (Cinnamon). I previously compiled and ran the same project without any issues, just using g++ and linking to the same libraries with pkg-config. I now want to use Qt just to make a GUI for my program.

      I am unable to link 2 system libraries for my project in Qt Creator. No matter how I try to link them, qmake fails to build because it cannot find them. First, I tried using pkg-config by adding the following to my .pro file:

          QT_CONFIG -= no-pkg-config
          CONFIG += link_pkgconfig
          PKG_CONFIG_PATH=:/usr/lib/x86_64-linux-gnu/pkgconfig
          PKGCONFIG += sndfile
          PKGCONFIG += jack
          PKGCONFIG += soundtouch
      

      But I just get a "jack development package not found" error message and it doesn't compile. Strangely, it finds sndfile, but not the other two. Also, it cannot find the system header files that I refer to, even if I explicitly put the full path from root in quotation marks. To troubleshoot, I tried using LIBS+=... and INCLUDEPATH+=... instead of pkg-config, but that didn't work either.

      So then, just to get it to compile, I tried manually adding each library .so file using right-click "Add Library", but in the file browser that pops up, many of the libraries in my /usr/lib/x86_64-linux-gnu/ folder are simply not there! (I can clearly see them when I use the file manager). It seems to me that the problem is that for some reason certain files in the root directory are invisible to Qt Creator and qmake. If I copy these same files to my project folder in the home directory and try to add them there, I can add them just fine. Same story with the header files in usr/include/.

      Does anyone know why this might be happening and how to fix it?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 21 Jan 2022, 15:26 last edited by
      #2

      @dhaus said in Qmake cannot find libraries:

      PKG_CONFIG_PATH=:/usr/lib/x86_64-linux-gnu/pkgconfig

      Are you sure the : before the path is correct?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • D Offline
        D Offline
        dhaus
        wrote on 23 Jan 2022, 03:38 last edited by
        #3

        No, but I've tried without it and it makes no difference.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          seyed
          wrote on 25 Apr 2022, 09:21 last edited by seyed
          #4

          The PKG_CONFIG_PATH is an environment variable so you need to add it before running qmake.
          So set it through Projects > Build Settings > Build Environment in QtCreator or set it through terminal before running qmake manually in terminal.

          Screen Shot 1401-02-05 at 13.30.41.png

          Then add following lines in your .pro file:

          mac {
            #if you need to specify
            PKG_CONFIG = /usr/local/bin/pkg-config
          }
          
          #someone says this need in some Qt versions but not need in my Qt 5.12.12
          QT_CONFIG -= no-pkg-config   
          
          CONFIG += link_pkgconfig
          PKGCONFIG += protobuf \
                       grpc \
                       grpc++
          

          I can't find a way to set environment variable in .pro file. Can you do it?

          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