artemsen / swayimg

Image viewer for Wayland
MIT License
379 stars 31 forks source link

Fix typo in libjxl detection #24

Closed jbeich closed 2 years ago

jbeich commented 2 years ago

libjxl (unlike brunsli) always supported pkg-config: either libjpegxl.pc (before v0.1) or libjxl.pc (since v0.1). Otherwise, find_library('foo') tests via -lfoo which expands to libfoo.so (or libfoo.a) but -l:foo expands to foo.

$ pkg info -x libjxl
libjxl-0.6.1_2

$ meson setup -Djxl=enabled _build
[...]
meson.build:35:0: ERROR: C shared or static library 'libjxl' not found
artemsen commented 2 years ago

Looks like there is a problem with dependency declaration in libjxl.pc, it has libhwy as "requires", but hwy is needed only to build libjxl itself. My system (Arch with libjxl 0.6.1-3) doesn't have libhwy.pc and pkconfig fails with:

$ pkg-config --cflags libjxl
Package libhwy was not found in the pkg-config search path.

As a result, meson cannot find libjxl:

The Meson build system
Version: 0.61.1
...
Run-time dependency libjxl found: NO (tried pkgconfig and cmake)
...

let's postpone this patch until Arch has a correct libjxl.pc.

eli-schwartz commented 2 years ago

Looks like there is a problem with dependency declaration in libjxl.pc, it has libhwy as "requires", but hwy is needed only to build libjxl itself.

I think this betrays a misunderstanding of how pkg-config works. Private dependencies must be installed, as a rule in order for the library to work. Whether the private dependencies get printed out as additional -lfoo flags is beside the point.

pkg-config requires private dependencies to exist, even without pkg-config --static, as a sanity check. So the real question would probably be "why, on some systems, is libjxl's dependency, libhwy, not installed as a dependency?"

artemsen commented 2 years ago

So the real question would probably be "why, on some systems, is libjxl's dependency, libhwy, not installed as a dependency?"

Ok, you are right. But I don't want to declare libhwy as a dependency of Swayimg, so... Let's postpone this patch until Arch has a correct libjxl.pc libhwy installed as dependency of libjxl =)

artemsen commented 2 years ago

Bug report in Arch: https://bugs.archlinux.org/task/73931