Picking this topic back up after some things got in between: l...@gnu.org (Ludovic Courtès) writes:
> taylanbayi...@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis: > >> Maybe I should try to move to a strategy that calls pkg-config instead >> of parsing the files in Guile, but it might be nontrivial to get the >> PKG_CONFIG_PATH right for each call, and doing many execs might be too >> slow, so I'll first see how much further I can get with this strategy. > > Yeah forking would be slow; parsing sounds good. However, the ‘satisfy’ > predicates could be based on actual package contents (when available): > looking for actual .pc files and libraries. I overhauled the strategy somewhat, and indeed look for actual .pc files (under $prefix/lib/pkgconfig directories) and libfoo.so files (under $prefix/lib directories) now. For .pc files, the extension is stripped, for libfoo.so files, the foo part is taken. These then serve as exact pkg-config package names and library names respectively, making everything more robust. Thanks for the idea! >> $ ./pre-inst-env guile -c '((@ (guix missing-propagated-inputs) >> print-missing-propagated-inputs))' >> "fftw": ("-lfftw3" "-lm") >> "fftwf": ("-lfftw3f" "-lm") > > This is a false positives: -lfftw3* is actually provided by the package > itself, and -lm is part of libc, so it’s always found (libc libraries > will have to be special-cased.) Libc components are now handled. The fftw3 stuff is handled fine under the new strategy. >> "apr": ("-ldl" "-lpthread" "-lcrypt" "-lrt" "-lapr-${APR_MAJOR_VERSION}") > > Again libc libraries, and the library of APR itself. Problem is that > this one requires almost a full reimplementation of pkg-config, to be > able to do variable substitution (probably not insurmountable though.) Implementing variable substitution was fairly straightforward, so these are fine now. >> "guile": ("-lgc" "-lffi") > > guile-2.0.pc has this: > > Libs: -L${libdir} -lguile-2.0 > -L/gnu/store/dxfv00pgmnhxkj5jh3yxyp0q94l6i2ch-libgc-7.4.2/lib -lgc > > So here -lgc is a false positive: libgc is found by virtue of the -L > flag. The -L flags are handled too now; the directory they point at is handled equivalently to $prefix/lib directories under the new strategy. (I.e. they're scanned for libfoo.so files.) > ‘-lffi’ only appears in ‘Libs.private’ (static linking) so I would just > ignore it. You're right; unlike Requires.private, Libs.private has no effect on e.g. pkg-config --exists, so it's really only for static linking; I removed the parsing of Libs.private fields. > It looks like there are 3 classes of false positives here that would > need to be addressed to make the report more directly readable. I think all these false positives are fixed now! New sample output from my machine: portaudio: pkg-config: () libs: ("asound") avahi: pkg-config: ("glib-2.0" "gobject-2.0" "glib-2.0") libs: () libatomic-ops: pkg-config: () libs: ("atomic_ops") ijs: pkg-config: () libs: ("ijs") mesa: pkg-config: ("xcb-dri3" "xcb-dri2" "libudev" "xcb-dri3" "xcb-dri2") libs: () dbus-glib: pkg-config: ("gobject-2.0" "glib-2.0" "dbus-1") libs: () libcroco: pkg-config: ("libxml-2.0" "glib-2.0") libs: () gst-plugins-base: pkg-config: ("gio-2.0" "glib-2.0" "gio-2.0") libs: () harfbuzz: pkg-config: ("icu-uc") libs: () gtk+: pkg-config: ("gio-2.0" "cairo" "gio-2.0" "cairo" "gio-2.0" "cairo") libs: () pango: pkg-config: ("gobject-2.0" "glib-2.0" "gmodule-no-export-2.0" "fontconfig" "freetype2" "xft") libs: () cairo: pkg-config: ("xcb-shm" "xcb-render" "xcb-render") libs: ("z" "z") eudev: pkg-config: ("gobject-2.0" "glib-2.0") libs: () qpdf: pkg-config: ("zlib") libs: () poppler: pkg-config: ("cairo" "cairo" "gio-2.0" "gobject-2.0" "glib-2.0") libs: () pulseaudio: pkg-config: ("glib-2.0") libs: () libdvdnav: pkg-config: ("dvdread") libs: () libxslt: pkg-config: ("libxml-2.0" "libxml-2.0") libs: ("z" "z") libxv: pkg-config: ("xproto" "xext" "x11") libs: () libx11: pkg-config: ("xproto") libs: () libxmu: pkg-config: ("xt" "x11" "xproto" "xext" "xt" "x11" "x11" "xproto" "x11") libs: () libxinerama: pkg-config: ("xext" "x11") libs: () libxft: pkg-config: ("xproto") libs: () libxext: pkg-config: ("x11") libs: () libxaw: pkg-config: ("xproto" "x11" "xproto" "x11") libs: () libxdmcp: pkg-config: ("xproto") libs: () libxpm: pkg-config: ("x11" "x11") libs: () libxkbfile: pkg-config: ("kbproto" "x11") libs: () xkbcomp: pkg-config: ("x11") libs: () libxxf86vm: pkg-config: ("x11") libs: () libxrender: pkg-config: ("x11" "xproto" "x11") libs: () libxfixes: pkg-config: ("xproto" "x11") libs: () libxt: pkg-config: ("xproto") libs: () libsm: pkg-config: ("xproto") libs: () Taylan