unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* static library
@ 2016-08-25 14:57 Vincent Legoll
  2016-08-28 19:35 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Legoll @ 2016-08-25 14:57 UTC (permalink / raw)
  To: guix-devel

Hello,

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=-L" ,a "/lib -la"))
        #:configure-flags (list (string-append "LDFLAGS=-L" ,a "/lib -la"))

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=-L" #<package urlmatch@1.0
/home/vince/guix-packages/fifth.scm:40 503c780> "/lib -lurlmatch"))
[...]

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)

Any help appreciated...

-- 
Vincent Legoll

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: static library
  2016-08-25 14:57 static library Vincent Legoll
@ 2016-08-28 19:35 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2016-08-28 19:35 UTC (permalink / raw)
  To: Vincent Legoll; +Cc: guix-devel

Vincent Legoll <vincent.legoll@gmail.com> 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=-L" ,a "/lib -la"))
>         #:configure-flags (list (string-append "LDFLAGS=-L" ,a "/lib -la"))
                                                              ^^
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=-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=-L" #<package urlmatch@1.0
> /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’s a ‘static-package’ procedure that
turns a GNU build system package into a statically-linked package.  If
your use case falls in that category, it’s enough to do:

  (define the-static-package
    (static-package the-package))

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-28 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25 14:57 static library Vincent Legoll
2016-08-28 19:35 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).