0

I'm building libevent from source with the following set of commands on Linux.

export LDFLAGS="-march=x86-64 -L/home/me/locals/lib64/zlib-1.2.11-gcc-9.3.0/lib"
export CPPFLAGS="-march=x86-64 -I/home/me/locals/lib64/zlib-1.2.11-gcc-9.3.0/include"

../configure --prefix=/home/me/locals/lib64/libevent-2.1.12-gcc-9.3.0

# Finally
make
make install

And this seems to be working. But I don't see anything related to generating package PKG_CONFIG files (*.pc)? How can I do that?

I have also the following active:

export PKG_CONFIG_PATH=$HOME/locals/lib/pkgconfig
mbilyanov
  • 2,315
  • 4
  • 29
  • 49
  • Isn't a pc file 4 lines of text? – stark Oct 03 '21 at 12:46
  • 1
    They are multiple files and I think the intention is to not write anything by hand :) I have found them under: `/home/me/locals/lib64/libevent-2.1.12-gcc-9.3.0/lib/pkgconfig`. So I just copied them to my global `PKG_CONFIG_PATH` location. – mbilyanov Oct 03 '21 at 12:46
  • Can you do `../configure --prefix=/home/me/locals` ? Then you don't have to do the copying. – Philippe Oct 03 '21 at 12:55
  • Oh, I see what you mean. Probably will work. What happens if I have multiple libevent libraries, I need to have different version tags in there, I’m not sure pkg-config supports that. – mbilyanov Oct 03 '21 at 14:08

1 Answers1

0

The answer actually came from @Philippe.

I didn't realise that the installation directory for the lib is also where the pkgconfig folder is placed, containing the *.pc files.

So if one installs the libs into one massive repo location such as ~/locals/libs, the pkgconfig folder will be placed in ~/locals/libs/pkgconfig and all the *.pc files will be stored there. This is one of the approaches. If such an approach is chosen, the PKG_CONFIG_PATH will look like this:

PKG_CONFIG_PATH=~/locals/libs/pkgconfig

There is another approach, where you can build your libs in their version tagged locations. In that case one will need to construct and handle the PKG_CONFIG_PATH environment variable in a more granular way. For example, the variable might look like this:

PKG_CONFIG_PATH=/home/me/locals/lib64/libevent-2.1.12/lib/pkgconfig:/home/me/locals/lib64/ncurses-6.2/lib/pkgconfig

Here is the detailed answer I got on the libevent's github issues page.

Do I have the option of generating package config (*.pc) files when building from source?

mbilyanov
  • 2,315
  • 4
  • 29
  • 49