unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Help on writing package definitions
@ 2020-04-23  6:32 Emmanuel Medernach
  2020-04-23 10:00 ` zimoun
  2020-04-23 16:44 ` Leo Famulari
  0 siblings, 2 replies; 9+ messages in thread
From: Emmanuel Medernach @ 2020-04-23  6:32 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]

Hello Guixers !

I am new to Guix and try to write package definitions to automate and make
some installation reproducible.

I have few questions:

- Why not export the license record type from license.scm ? Some project
has its own license and I cannot create it.

- I have errors when I try to build with guix that I don't have when I
build manually. I have a package (asiofi) which depends on another one
(libfabric) but the build does not find it. Here is my current file
attached and the command I use:

# guix build -K --load-path=/home/emederna/src/packages -e '(@ (CBM)
asiofi)'
...
CMake Error at test/CMakeLists.txt:9 (add_executable):
  Target "afi_msg_bw" links to target "OFI::libfabric" but the target was
not
  found.  Perhaps a find_package() call is missing for an IMPORTED target,
or
  an ALIAS target is missing?

Manually the compilation works fine, what am I missing ?

Thanks in advance

Best regards,

Emmanuel Medernach

[-- Attachment #2: CBM.scm --]
[-- Type: text/x-scheme, Size: 2743 bytes --]


(define-module (CBM)

  #:use-module  (guix packages)
  #:use-module  (guix download)
  #:use-module  (guix build-system cmake)
  #:use-module  (guix build-system gnu)

  #:use-module  (gnu packages autotools)
  #:use-module  (gnu packages commencement) ;; gcc-toolchain

  #:use-module  (gnu packages boost)
  #:use-module  (gnu packages sqlite)

  #:use-module  ((guix licenses) #:prefix license:))


(define-public libfabric
  (package
    (name "libfabric")
    (version "1.9.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://github.com/ofiwg/libfabric/archive/v"
             version
             ".tar.gz"))
       (sha256
        (base32
         "0sic649kg9jhljqhffgyc5pihpysc8gjg0hc924rs5wxv5qxypvn"))))
    (build-system gnu-build-system)
    (inputs
     `(("autoconf" ,autoconf) ;; autogen autoreconf
       ("automake" ,automake) ;; aclocal
       ("libtool" ,libtool) 
       ))

    (home-page "https://github.com/ofiwg/libfabric")
    (synopsis "Open Fabrics Interfaces")
    (description "Framework focused on exporting fabric communication services to applications.")
    (license license:bsd-2)))

(define-public asiofi
  (package
    (name "asiofi")
    (version "0.4.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append
             "https://github.com/FairRootGroup/asiofi/archive/v"
             version
             ".tar.gz"))
       (sha256
        (base32
         "0q88k7kffpa66327gnd7wwzrhqnhmqxpgyqa68aqs7l28f4iq9sn"))))
    (build-system cmake-build-system)
    (inputs
     `(("gcc-toolchain" ,gcc-toolchain)
       ("libfabric" ,libfabric)
       ("boost" ,boost)))
    (arguments
     `(;; #:configure-flags
       ;; (list
       ;; 	;; find_package uses <PackageName>_ROOT variables.
       ;; 	;; For compatibility, CMake is ignoring the variable.
       ;; 	(string-append "-DOFI_ROOT="
       ;; 		       (assoc-ref %build-inputs "libfabric")
       ;; 		       ))
       
       #:phases       
       (modify-phases
	%standard-phases
	(add-after
	 'unpack 'use-system-libraries
	 (lambda _
	   (substitute*
	    "cmake/asiofiLib.cmake"
	    (("### PUBLIC") "cmake_policy(SET CMP0074 NEW)"))
	   #t))
	(add-before
	 'configure 'OFI
	 (lambda _
	   (let ((libfabric-path (assoc-ref %build-inputs "libfabric")))
	     (let* ((var (getenv "PKG_CONFIG_PATH"))
	     	    (result (string-append 
			     (if var (string-append var ":") "")
			     libfabric-path
			     "/lib/pkgconfig")))
	       (setenv "PKG_CONFIG_PATH" result))))))))

    (home-page "https://github.com/FairRootGroup/asiofi")
    (synopsis "C++ Boost.Asio language bindings for OFI libfabric")
    (description "")
    (license license:lgpl2.1+)))




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

* Re: Help on writing package definitions
@ 2020-04-23  9:41 Vincent Legoll
  2020-04-23 12:09 ` Emmanuel Medernach
  0 siblings, 1 reply; 9+ messages in thread
From: Vincent Legoll @ 2020-04-23  9:41 UTC (permalink / raw)
  To: emmanuel.medernach, help-guix

Hello Emmanuel,

really nice to see you here !

A few smallish comments on your code (I'll try to build it later)

You mixed tabs & spaces for indentation.

Looks like the second lambda does not return #t, if I'm not mistaken
the return value will be setenv's which is unspecified.

I'll try to be more helpful in my next reply ;-)

And sorry if my answer broke the threading, I just subscribed...

-- 
Vincent Legoll

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

* Re: Help on writing package definitions
  2020-04-23  6:32 Help on writing package definitions Emmanuel Medernach
@ 2020-04-23 10:00 ` zimoun
  2020-04-23 12:21   ` Emmanuel Medernach
  2020-04-23 16:44 ` Leo Famulari
  1 sibling, 1 reply; 9+ messages in thread
From: zimoun @ 2020-04-23 10:00 UTC (permalink / raw)
  To: Emmanuel Medernach; +Cc: help-guix

Dear,


On Thu, 23 Apr 2020 at 10:29, Emmanuel Medernach
<emmanuel.medernach@gmail.com> wrote:

> - Why not export the license record type from license.scm ? Some project
> has its own license and I cannot create it.

You mean the project's license is not part of this list [1], right?

[1] https://www.gnu.org/licenses/license-list.html


Otherwise, I do not have the answer for your question. :-)


> - I have errors when I try to build with guix that I don't have when I
> build manually. I have a package (asiofi) which depends on another one
> (libfabric) but the build does not find it. Here is my current file
> attached and the command I use:
>
> # guix build -K --load-path=/home/emederna/src/packages -e '(@ (CBM)
> asiofi)'

Does the '#' at the beginning mean that your are running as root?

Well, I find easier 1/ to log in as 'emederna' user and 2/ to run

  guix build -L ~/src/packages asiofi


> CMake Error at test/CMakeLists.txt:9 (add_executable):
>   Target "afi_msg_bw" links to target "OFI::libfabric" but the target was
> not
>   found.  Perhaps a find_package() call is missing for an IMPORTED target,
> or
>   an ALIAS target is missing?

From my understanding, there are 3 "issues":

 a) instead of create a full new package for libfabric, you could
update the Guix one or use 'inherit', e.g., (not tested)

(define-public my-libfabric
  (inherit libfabric
     (version "X.Y")
     (source blablabla)))

 b) missing '#t' to the phase 'add-before'

 c) missing the package 'pkg-config', i.e.,
       #:use-module  (gnu packages pkg-config)
and
    ("pkgconfig" ,pkg-config)
in the list of inputs.


Now, it seems compiling on my machine. :-)


Hope that helps.
simon

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

* Re: Help on writing package definitions
  2020-04-23  9:41 Vincent Legoll
@ 2020-04-23 12:09 ` Emmanuel Medernach
  2020-04-23 12:17   ` Vincent Legoll
  0 siblings, 1 reply; 9+ messages in thread
From: Emmanuel Medernach @ 2020-04-23 12:09 UTC (permalink / raw)
  To: Vincent Legoll; +Cc: help-guix

Hello Vincent, glad to read from you here !

Thanks for your hints, I didn't realize that it should return #t at the
end. However I still have the same error.

Emmanuel

On Thu, Apr 23, 2020 at 11:41 AM Vincent Legoll <vincent.legoll@gmail.com>
wrote:

> Hello Emmanuel,
>
> really nice to see you here !
>
> A few smallish comments on your code (I'll try to build it later)
>
> You mixed tabs & spaces for indentation.
>
> Looks like the second lambda does not return #t, if I'm not mistaken
> the return value will be setenv's which is unspecified.
>
> I'll try to be more helpful in my next reply ;-)
>
> And sorry if my answer broke the threading, I just subscribed...
>
> --
> Vincent Legoll
>

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

* Re: Help on writing package definitions
  2020-04-23 12:09 ` Emmanuel Medernach
@ 2020-04-23 12:17   ` Vincent Legoll
  0 siblings, 0 replies; 9+ messages in thread
From: Vincent Legoll @ 2020-04-23 12:17 UTC (permalink / raw)
  To: Emmanuel Medernach; +Cc: help-guix

On 23/04/2020 14:09, Emmanuel Medernach wrote:
> Hello Vincent, glad to read from you here !

Small world ;-)

Hope to see you soon(-ish) in Strasbourg ! [1]

> Thanks for your hints, I didn't realize that it should return
> #t at the  end. However I still have the same error.

Yes, this is not the one breaking the build. I'm still low on
the scheme/guix learning curve.

I think you got a more complete answer from Simon.

The pkgconfig & libfabric hints should help.

[1] BTW, I ate with Jérôme a few weeks before the lock-down.

-- 
Vincent Legoll

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

* Re: Help on writing package definitions
  2020-04-23 10:00 ` zimoun
@ 2020-04-23 12:21   ` Emmanuel Medernach
  2020-04-23 14:17     ` zimoun
  0 siblings, 1 reply; 9+ messages in thread
From: Emmanuel Medernach @ 2020-04-23 12:21 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

On Thu, Apr 23, 2020 at 12:00 PM zimoun <zimon.toutoune@gmail.com> wrote:

> Dear,
>
>
> On Thu, 23 Apr 2020 at 10:29, Emmanuel Medernach
> <emmanuel.medernach@gmail.com> wrote:
>
> > - Why not export the license record type from license.scm ? Some project
> > has its own license and I cannot create it.
>
> You mean the project's license is not part of this list [1], right?
>
> [1] https://www.gnu.org/licenses/license-list.html
>
>
> Otherwise, I do not have the answer for your question. :-)
>
>
Yes, it is not listed in this list because it is specific to the project. I
would like to be able to create one new license but the license function is
not exported.


> > - I have errors when I try to build with guix that I don't have when I
> > build manually. I have a package (asiofi) which depends on another one
> > (libfabric) but the build does not find it. Here is my current file
> > attached and the command I use:
> >
> > # guix build -K --load-path=/home/emederna/src/packages -e '(@ (CBM)
> > asiofi)'
>
> Does the '#' at the beginning mean that your are running as root?
>
> Well, I find easier 1/ to log in as 'emederna' user and 2/ to run
>
>   guix build -L ~/src/packages asiofi
>
>
No, I am not root, this is my prompt :)

Ok, this command is much shorter.


> > CMake Error at test/CMakeLists.txt:9 (add_executable):
> >   Target "afi_msg_bw" links to target "OFI::libfabric" but the target was
> > not
> >   found.  Perhaps a find_package() call is missing for an IMPORTED
> target,
> > or
> >   an ALIAS target is missing?
>
> From my understanding, there are 3 "issues":
>
>  a) instead of create a full new package for libfabric, you could
> update the Guix one or use 'inherit', e.g., (not tested)
>
> (define-public my-libfabric
>   (inherit libfabric
>      (version "X.Y")
>      (source blablabla)))
>
>  b) missing '#t' to the phase 'add-before'
>
>  c) missing the package 'pkg-config', i.e.,
>        #:use-module  (gnu packages pkg-config)
> and
>     ("pkgconfig" ,pkg-config)
> in the list of inputs.
>
>
> Now, it seems compiling on my machine. :-)
>
>
Wonderful ! It works now. Thanks for your help.

How do you debugged this issue to find that we have to add pkgconfig ?

Emmanuel

>
> Hope that helps.
> simon
>

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

* Re: Help on writing package definitions
  2020-04-23 12:21   ` Emmanuel Medernach
@ 2020-04-23 14:17     ` zimoun
  0 siblings, 0 replies; 9+ messages in thread
From: zimoun @ 2020-04-23 14:17 UTC (permalink / raw)
  To: Emmanuel Medernach; +Cc: help-guix

On Thu, 23 Apr 2020 at 14:21, Emmanuel Medernach
<emmanuel.medernach@gmail.com> wrote:

> Yes, it is not listed in this list because it is specific to the project. I would like to be able to create one new license but the license function is not exported.

It appears to me a good idea to export the record 'license'.

The tiniest trivial patch [1] ;-)

[1] http://issues.guix.gnu.org/40795


> How do you debugged this issue to find that we have to add pkgconfig ?

Because the 'modify-phases' uses pkg-config and everything is isolated.

To be fully clean, 'pkg-config' should go to 'native-inputs' [2];
maybe the others too, do not know enough about your package.

[2] https://guix.gnu.org/manual/en/guix.html#package-Reference


All the best,
simon

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

* Re: Help on writing package definitions
  2020-04-23  6:32 Help on writing package definitions Emmanuel Medernach
  2020-04-23 10:00 ` zimoun
@ 2020-04-23 16:44 ` Leo Famulari
  2020-04-23 17:11   ` zimoun
  1 sibling, 1 reply; 9+ messages in thread
From: Leo Famulari @ 2020-04-23 16:44 UTC (permalink / raw)
  To: Emmanuel Medernach; +Cc: help-guix

On Thu, Apr 23, 2020 at 08:32:35AM +0200, Emmanuel Medernach wrote:
> - Why not export the license record type from license.scm ? Some project
> has its own license and I cannot create it.

In general, we don't add project-specific licenses to licenses.scm or as
their own variables.

Instead, we use the non-copyleft, fsf-free, or fsdg-compatible license
variables.

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

* Re: Help on writing package definitions
  2020-04-23 16:44 ` Leo Famulari
@ 2020-04-23 17:11   ` zimoun
  0 siblings, 0 replies; 9+ messages in thread
From: zimoun @ 2020-04-23 17:11 UTC (permalink / raw)
  To: Leo Famulari; +Cc: help-guix, Emmanuel Medernach

On Thu, 23 Apr 2020 at 18:55, Leo Famulari <leo@famulari.name> wrote:
>
> On Thu, Apr 23, 2020 at 08:32:35AM +0200, Emmanuel Medernach wrote:
> > - Why not export the license record type from license.scm ? Some project
> > has its own license and I cannot create it.
>
> In general, we don't add project-specific licenses to licenses.scm or as
> their own variables.
>
> Instead, we use the non-copyleft, fsf-free, or fsdg-compatible license
> variables.

Considering the inclusion of such packages in Guix.

But if one wants to define its own custom license used by its own
custom package living in its own custom channel, then the API needs to
expose the 'license' record. Done here [1].

[1] http://issues.guix.gnu.org/40795


Cheers,
simon

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

end of thread, other threads:[~2020-04-23 17:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23  6:32 Help on writing package definitions Emmanuel Medernach
2020-04-23 10:00 ` zimoun
2020-04-23 12:21   ` Emmanuel Medernach
2020-04-23 14:17     ` zimoun
2020-04-23 16:44 ` Leo Famulari
2020-04-23 17:11   ` zimoun
  -- strict thread matches above, loose matches on Subject: below --
2020-04-23  9:41 Vincent Legoll
2020-04-23 12:09 ` Emmanuel Medernach
2020-04-23 12:17   ` Vincent Legoll

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).