From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: static library Date: Sun, 28 Aug 2016 21:35:14 +0200 Message-ID: <87wpj0znyl.fsf@gnu.org> References: 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]:55144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1be5rW-000728-GH for guix-devel@gnu.org; Sun, 28 Aug 2016 15:35:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1be5rT-0004b4-9U for guix-devel@gnu.org; Sun, 28 Aug 2016 15:35:22 -0400 In-Reply-To: (Vincent Legoll's message of "Thu, 25 Aug 2016 16:57:38 +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" To: Vincent Legoll Cc: guix-devel Vincent Legoll skribis: > I'm trying to package & use a static library (not mine), but it looks like > the right "-L" parameter is not automagically passed to the user package > (where the lib is in (inputs ...)) > > something like the following: > > (define-public a (package ...)) > (define-public b (package ... (inputs `(("liba" ,a))) ...)) > > I tried to put the right -L into make-flags & configure-flags myself, but > it failed with error, I don't even know if I have to do that : > > (define-public b (package ... > (arguments > `(#:make-flags (list (string-append "LDFLAGS=3D-L" ,a "/lib -la")) > #:configure-flags (list (string-append "LDFLAGS=3D-L" ,a "/lib -l= a")) ^^ Since packages do not use gexps (yet), you have to do the more complicated thing here: (inputs `(("the-label-for-a" ,a))) (arguments '(#:make-flags (list (string-append "LDFLAGS=3D-L" (assoc-ref %build-inputs "the-label-for-a"))))) > this ended with: > > ERROR: In procedure primitive-load: > ERROR: In procedure scm_lreadr: /gnu/store/*-guile-builder:1:5211: > Unknown # object: #\< > > which is in this : > > [...] > #:phases %standard-phases #:locale "en_US.utf8" #:configure-flags > (list (string-append "LDFLAGS=3D-L" # /home/vince/guix-packages/fifth.scm:40 503c780> "/lib -lurlmatch")) > [...] And indeed, we see the package object was written as is in the build script above. > I did find a use of static lib (apart from libgcc) in utils-linux but > nothing here seems special (even the *.a move looks optional) In (guix build-system gnu), there=E2=80=99s a =E2=80=98static-package=E2=80= =99 procedure that turns a GNU build system package into a statically-linked package. If your use case falls in that category, it=E2=80=99s enough to do: (define the-static-package (static-package the-package)) HTH! Ludo=E2=80=99.