How to add pthreads to pkg-config

1,100 views
Skip to first unread message

Nikolaus Rath

unread,
Jan 5, 2017, 1:15:40 PM1/5/17
to meson...@googlegroups.com
Hello,

How do I add pthreads when generating the pkg-config file?

I tried:

threads = dependency('threads')
# ...
pkg = import('pkgconfig')
pkg.generate(libraries: [libfuse, threads],
version: meson.project_version(),
name: 'fuse3',
description: 'Filesystem in Userspace',
subdirs: 'fuse3')

but this fails with "Library argument not a library object nor a string."

If I omit "threads" from the "libraries" argument, the .pc is generated
fine, but the -lpthread argument is missing in the "Libs" line.

Thanks,
-Nikolaus

--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

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

Jussi Pakkanen

unread,
Jan 5, 2017, 1:27:21 PM1/5/17
to The Meson Build System
On Thu, Jan 5, 2017 at 8:15 PM, Nikolaus Rath <Niko...@rath.org> wrote:

> pkg.generate(libraries: [libfuse, threads],
> version: meson.project_version(),
> name: 'fuse3',
> description: 'Filesystem in Userspace',
> subdirs: 'fuse3')
>
> but this fails with "Library argument not a library object nor a string."
>
> If I omit "threads" from the "libraries" argument, the .pc is generated
> fine, but the -lpthread argument is missing in the "Libs" line.

Strings are passed through directly, so libraries : [libfuse,
'-lpthread']. This is not the greatest of UIs, but unfortunately the
way threading works on different platforms is one huge Rube Goldberg
machine. :(

Nikolaus Rath

unread,
Jan 5, 2017, 2:14:26 PM1/5/17
to meson...@googlegroups.com
Hmm. Ok. Is this also the only solution for libraries found with
.find_library() (like 'dl')? I wasn't able to pass them to
pkg.generate() either.


Best,

Jussi Pakkanen

unread,
Jan 5, 2017, 6:19:37 PM1/5/17
to The Meson Build System
On Thu, Jan 5, 2017 at 9:14 PM, Nikolaus Rath <Niko...@rath.org> wrote:

> Hmm. Ok. Is this also the only solution for libraries found with
> .find_library() (like 'dl')? I wasn't able to pass them to
> pkg.generate() either.

It is. We should probably do something about that...
Reply all
Reply to author
Forward
0 new messages