From mboxrd@z Thu Jan 1 00:00:00 1970 From: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer?=) Subject: Re: pkg-config "Requires" fields and propagated inputs Date: Wed, 29 Apr 2015 22:17:42 +0200 Message-ID: <87fv7ieljt.fsf@taylan.uni.cx> References: <87d2444stf.fsf@taylan.uni.cx> <87iodnh0we.fsf@taylan.uni.cx> <87pp7pcqjg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnYQU-0001BC-Nh for guix-devel@gnu.org; Wed, 29 Apr 2015 16:17:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnYQT-00023M-Ci for guix-devel@gnu.org; Wed, 29 Apr 2015 16:17:46 -0400 In-Reply-To: <87pp7pcqjg.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 31 Mar 2015 14:14:27 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org Picking this topic back up after some things got in between: ludo@gnu.org (Ludovic Court=C3=A8s) writes: > taylanbayirli@gmail.com (Taylan Ulrich "Bay=C4=B1rl=C4=B1/Kammer") skribi= s: > >> 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 =E2=80=98s= atisfy=E2=80=99 > 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-mi= ssing-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=E2=80=99s always found (libc libra= ries > 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/dxfv00pgmnhxkj5jh3yxyp0q94l6= i2ch-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.) > =E2=80=98-lffi=E2=80=99 only appears in =E2=80=98Libs.private=E2=80=99 (s= tatic 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") l= ibs: () 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") l= ibs: () pango: pkg-config: ("gobject-2.0" "glib-2.0" "gmodule-no-export-2.0" "fontc= onfig" "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") l= ibs: () 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