2

I am trying to run make for an open-source project on my Debian virtual machine but I do not understand why the commands based on pkg-config are not being recognized.

One of the commands is as follows:

tempgui-qrps.so: tempgui-qrps.cc refpersys.hh tempgui-qrps.hh tempgui-qrps.moc.hh | $(RPS_CORE_OBJECTS)
    $(RPS_BUILD_CXX) $(RPS_BUILD_COMPILER_FLAGS) \
                         -shared -o $@ -fPIC -Wall -Wextra -O -g \
                  $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets $(RPS_PKG_NAMES)) \
                  $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets $(RPS_PKG_NAMES)) \
                      -std=gnu++17 \
    $<

When I run make on the command line, the output corresponding to the above command looks like this:

g++ -std=gnu++17 \                          
    -shared -o tempgui-qrps.so -fPIC -Wall -Wextra -O -g \                
                                  \                
                                   \                      
                                    -std=gnu++17 \ 
tempgui-qrps.cc 

When I run the make command, I also see these warnings:

Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package zlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `zlib.pc'
to the PKG_CONFIG_PATH environment variable
No package 'zlib' found

Are both these problems (absence of packages and the pkg-config commands not being processed) related?

Some of the details of pkg-config installed on my system are as follows:

xxxxx@xxxx:~$ pkg-config --version
0.29

xxxx@xxxx:~$ whereis pkg-config
pkg-config: /usr/bin/pkg-config /usr/lib/pkg-config.multiarch /usr/share/man/man1/pkg-config.1.gz
2
  • No readline.pc, no zlib.pc in /usr/lib/x86_64-linux-gnu/pkgconfig/ : Install libreadline-dev zlib1g-dev Aug 1, 2021 at 5:03
  • @KnudLarsen Thank you for the response. I believe libreadline-dev is installed on my system. My output for locate libreadline-dev: /usr/share/doc/libreadline-dev.
    – a_sid
    Aug 1, 2021 at 5:08

1 Answer 1

4

Having pkg-config isn’t sufficient: you also need the .pc files corresponding to the packages named in each pkg-config command.

For pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets $(RPS_PKG_NAMES), you need to install qtbase5-dev, and whatever is necessary for the packages in $(RPS_PKG_NAMES). You can install and use apt-file to find packages containing specific files.

For readline and zlib, you need libreadline-dev and zlib1g-dev. In addition, you’ll need to create readline.pc if you’re using Debian 10; place it in /usr/local/lib/pkgconfig, with the following contents:

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib/x86_64-linux-gnu
includedir=${prefix}/include

Name: Readline
Description: Gnu Readline library for command line editing
URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
Version: 7.0
Requires.private: tinfo

(for amd64).

You can run the various pkg-config commands from the shell to check that they are working, and get information aboit each individual error.

4
  • Thank you for the response. When I run pkg-config --ldflags Qt5Core I see the lib files for it. I see similar output when I run pkg-config --ldflags Qt5Widgets and pkg-config --ldflags Qt5Gui. I have not yet tried running the pkg-config on all of them together as you have suggested.
    – a_sid
    Aug 1, 2021 at 16:04
  • You also need to determine the value of $(RPS_PKG_NAMES) and check those packages (I suspect that’s where the readline and zlib errors come from). Aug 1, 2021 at 17:36
  • Yes I saw that readline and zlib are both assigned to $(RPS_PKG_NAMES). I also checked they do not have .pc files on my system.
    – a_sid
    Aug 1, 2021 at 17:40
  • 2
    The lack of readline.pc is normal, see the details in the answer. If you have the zlib1g-dev package installed, you should have /usr/lib/x86_64-linux-gnu/pkgconfig/zlib.pc on your system. Aug 1, 2021 at 17:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .