pkg-config files installed in wrong directory

482 views
Skip to first unread message

Nikolaus Rath

unread,
Jun 21, 2017, 7:20:08 PM6/21/17
to meson...@googlegroups.com
Hello,

I have defined the following pkg-config file:

pkg = import('pkgconfig')
pkg.generate(libraries: [ libfuse, '-lpthread' ],
libraries_private: '-ldl',
version: meson.project_version(),
name: 'fuse3',
description: 'Filesystem in Userspace',
subdirs: 'fuse3')

On my Debian jessie system, this means Meson puts the files into
/usr/local/lib/x86_64-linux-gnu/:

$ ninja
[0/1] Regenerating build files
The Meson build system
Version: 0.39.0
Source dir: /home/nikratio/in-progress/libfuse
Build dir: /home/nikratio/in-progress/libfuse/build
Build type: native build
Project name: libfuse3
Native c compiler: cc (gcc 4.9.2)
Build machine cpu family: x86_64
Build machine cpu: x86_64
[...]
$ sudo ninja install
[...]
Installing /home/nikratio/in-progress/libfuse/build/meson-private/fuse3.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig.


Unfortunately that's not a location that pkg-config considers.

What's the best way to fix this?


Thanks,
-Nikolaus

--
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

»Time flies like an arrow, fruit flies like a Banana.«

Jussi Pakkanen

unread,
Jun 22, 2017, 2:10:26 PM6/22/17
to The Meson Build System
On Thu, Jun 22, 2017 at 2:20 AM, Nikolaus Rath <Niko...@rath.org> wrote:

> On my Debian jessie system, this means Meson puts the files into
> /usr/local/lib/x86_64-linux-gnu/:
>
> Unfortunately that's not a location that pkg-config considers.
>
> What's the best way to fix this?

FWICT /usr/local/lib[whatever] is not in the default directories for
looking up shared libraries so it is not surprising that it is also
not used to look up pkg-config files either. Probably the only
reliable way to make this work is to set LD_LIBRARY_PATH and
PKG_CONFIG_PATH to point to their respective directories and then it
should work.

Some distros might have /usr/local/lib and /usr/loca/lib/pkgconfig in
the system search path, in which case just setting libdir to "lib"
should make it work. However that is not guaranteed to work on all
distros.

Nikolaus Rath

unread,
Jun 22, 2017, 2:34:18 PM6/22/17
to meson...@googlegroups.com
On Jun 22 2017, Jussi Pakkanen <jpak...@gmail.com> wrote:
> On Thu, Jun 22, 2017 at 2:20 AM, Nikolaus Rath <Niko...@rath.org> wrote:
>
>> On my Debian jessie system, this means Meson puts the files into
>> /usr/local/lib/x86_64-linux-gnu/:
>>
>> Unfortunately that's not a location that pkg-config considers.
>>
>> What's the best way to fix this?
>
> FWICT /usr/local/lib[whatever] is not in the default directories for
> looking up shared libraries

Well, that depends on your definition of "default". It is the default on
Debian, and I believe pretty much the only way to make multi-arch work.

> so it is not surprising that it is also
> not used to look up pkg-config files either. Probably the only
> reliable way to make this work is to set LD_LIBRARY_PATH and
> PKG_CONFIG_PATH to point to their respective directories and then it
> should work.

No, there is no special LD_LIBRARY_PATH required. As far as I can tell,
PKG_CONFIG_PATH is used by pkg-config at runtime to determine where to
look at files, but not at build-time by Meson to determine where to put
files. Am I missing something?


> Some distros might have /usr/local/lib and /usr/loca/lib/pkgconfig in
> the system search path, in which case just setting libdir to "lib"
> should make it work. However that is not guaranteed to work on all
> distros.

No, this will unfortunately put the .so files in the wrong
directory. Note that I am not explicitly setting libdir to anything, the
default (including arch triplet) has been determined by Meson.

For reference:

$ mesonconf
Core properties:
Source dir /home/nikratio/in-progress/libfuse
Build dir /home/nikratio/in-progress/libfuse/build
[...]

Directories:
Option Description Current Value
------ ----------- -------------
prefix Installation prefix. /usr/local
libdir Library directory. lib/x86_64-linux-gnu
libexecdir Library executable directory. libexec
bindir Executable directory. bin
sbindir System executable directory. sbin
includedir Header file directory. include
datadir Data file directory. share
mandir Manual page directory. share/man
infodir Info page directory. share/info
localedir Locale data directory. share/locale
sysconfdir Sysconf data directory. etc
localstatedir Localstate data directory. var
sharedstatedir Architecture-independent data directory. com

[...]



Best,

Matthieu Gautier

unread,
Jun 23, 2017, 3:48:02 AM6/23/17
to meson...@googlegroups.com
Hello,

Just to mention that I think this is probably related to the issue I've
recently opened here : https://github.com/mesonbuild/meson/issues/1972

Detecting `lib/[arch-triplet]` as libprefix on Debian seems to be
usefull only if installing in `/usr` prefix.
But, by default, the prefix is `/usr/local`.
(On redhat based distro, the libprefix is not so important as
`/usr/local/lib*` is not in the defaults library directories at all)


Regards,
Matthieu Gautier.

Nikolaus Rath

unread,
Jul 6, 2017, 6:37:23 AM7/6/17
to meson...@googlegroups.com
*ping*

Jussi, any comment?

Thanks!
-Nikolaus
> --
> You received this message because you are subscribed to the Google Groups "The Meson Build System" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mesonbuild+...@googlegroups.com.
> To post to this group, send an email to meson...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/mesonbuild/877f03q3bt.fsf%40thinkpad.rath.org.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages