diff mbox series

[bug#39013] gnu: Add abseil-cpp.

Message ID 1f9fb8236e2a652ea4389c8d18b663307b275153.camel@gnu.org
State Accepted
Headers show
Series [bug#39013] gnu: Add abseil-cpp. | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Roel Janssen Jan. 7, 2020, 3:07 p.m. UTC
Dear Guix,

The following patch adds abseil-cpp.  I want to add it because it seems
to be a dependency of tensorflow-1.15.0 (which I am trying to update
to).

There are two not-so-perfect things with the patch:
1. I had to use the latest Git commit because it adds bits to build
shared libraries.
2. I disabled the tests because it attempts to download "googletest". 
I tried modifying the build system to use "googletest" from Guix but
that wasn't succesful.

Nevertheless, I hope this patch is acceptable.

Kind regards,
Roel Janssen

Comments

Ludovic Courtès Jan. 9, 2020, 9:53 p.m. UTC | #1
Hi Roel,

Roel Janssen <roel@gnu.org> skribis:

> There are two not-so-perfect things with the patch:
> 1. I had to use the latest Git commit because it adds bits to build
> shared libraries.

Sounds good to me.

> 2. I disabled the tests because it attempts to download "googletest". 
> I tried modifying the build system to use "googletest" from Guix but
> that wasn't succesful.

There are packages such as ‘encfs’ where we simply unpack the source of
our ‘googletest’ package in the right place.  Would what work here?

> From 06ed0284561463c087ec0f16f9c35fc7926f22df Mon Sep 17 00:00:00 2001
> From: Roel Janssen <roel@gnu.org>
> Date: Tue, 7 Jan 2020 16:02:28 +0100
> Subject: [PATCH] gnu: Add abseil-cpp.
>
> * gnu/packages/machine-learning.scm (abseil-cpp): New variable.

[...]

> +      (description "Abseil is an open-source collection of C++ library code

s/an open-source/a/

> +designed to augment the C++ standard library.  The Abseil library code is
> +collected from Google's own C++ code base, has been extensively tested and
> +used in production, and is the same code we depend on in our daily coding
> +lives.")

Who’s “we”?  :-)  Would be great if you could make that more factual.

Apart from that it LGTM.

Thanks,
Ludo’.
Roel Janssen Jan. 10, 2020, 7:23 p.m. UTC | #2
On Thu, 2020-01-09 at 22:53 +0100, Ludovic Courtès wrote:
> Hi Roel,
> 
> Roel Janssen <roel@gnu.org> skribis:
> 
> > There are two not-so-perfect things with the patch:
> > 1. I had to use the latest Git commit because it adds bits to build
> > shared libraries.
> 
> Sounds good to me.
> 
> > 2. I disabled the tests because it attempts to download "googletest". 
> > I tried modifying the build system to use "googletest" from Guix but
> > that wasn't succesful.
> 
> There are packages such as ‘encfs’ where we simply unpack the source of
> our ‘googletest’ package in the right place.  Would what work here?


No.  Here's an inline version of the package, because I've had enough trouble
with Guix this week.


(define-public abseil-cpp
  ;; We use this commit because it contains changes to the build system to
  ;; allow building shared libraries.
  (let ((commit "a048203a881f11f4b7b8df5fb563aec85522f8db"))
    (package
      (name "abseil-cpp")
      (version (string-append "20190808-" (string-take commit 7)))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/abseil/abseil-cpp.git")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "13v3bkfyhrcl9am0jcz4cfbfc5rn3acm9z4wm01pn36vcgvw2l4s"))))
      (build-system cmake-build-system)
      (arguments
       `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON" "-DABSL_RUN_TESTS=ON")
         #:phases
         (modify-phases %standard-phases
           (add-before 'configure 'unpack-googletest
             (lambda* (#:key inputs #:allow-other-keys)
               ;; So, the CMake 'configure' phase expects the googletest-src
               ;; and googletest-build directories to be in the ../build
               ;; directory, but the Guix 'configure' phase creates the
               ;; directory using (mkdir "../build"), which errors out when
               ;; we have already created the build directory.
               ;;
               ;; The code below errors out, so if you have a solution for
               ;; this, that would be great.  Until that time I will simply
               ;; postpone working on upgrading the TensorFlow package in
               ;; the upstream repository of Guix.
               (mkdir-p "../build")
               (with-directory-excursion "../build"
                 (format #t "We're in ~s~%" (getcwd))
                 (mkdir-p "googletest-src")
                 (mkdir-p "googletest-build")
                 (copy-recursively
                  (assoc-ref inputs "googletest-source")
                  "googletest-src")
                 (copy-recursively
                  (assoc-ref inputs "googletest")
                  "googletest-build"))
                 #t))
           (replace 'check
           (lambda _
             (invoke "ctest"))))))
      (native-inputs
       `(("googletest-source" ,(package-source googletest))
         ("googletest" ,googletest)))
      (home-page "https://abseil.io")
      (synopsis "Augmented C++ standard library")
      (description "Abseil is a collection of C++ library code designed to
augment the C++ standard library.  The Abseil library code is collected from
Google's C++ code base.")
      (license license:asl2.0))))


Thanks,
Roel
Ludovic Courtès Jan. 15, 2020, 8:53 p.m. UTC | #3
Hi Roel,

Roel Janssen <roel@gnu.org> skribis:

> On Thu, 2020-01-09 at 22:53 +0100, Ludovic Courtès wrote:

[...]

>> There are packages such as ‘encfs’ where we simply unpack the source of
>> our ‘googletest’ package in the right place.  Would what work here?
>
>
> No.  Here's an inline version of the package, because I've had enough trouble
> with Guix this week.

Oh, I understand the frustration.  I gather we’ll put this on hold for now.

Thanks for your help,
Ludo’.
diff mbox series

Patch

From 06ed0284561463c087ec0f16f9c35fc7926f22df Mon Sep 17 00:00:00 2001
From: Roel Janssen <roel@gnu.org>
Date: Tue, 7 Jan 2020 16:02:28 +0100
Subject: [PATCH] gnu: Add abseil-cpp.

* gnu/packages/machine-learning.scm (abseil-cpp): New variable.
---
 gnu/packages/machine-learning.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 719401d69a..91cc4fe091 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1316,6 +1316,34 @@  mile of distributed computing to connect devices, mobile applications and
 browsers to backend services.")
     (license license:asl2.0)))
 
+(define-public abseil-cpp
+  ;; We use this commit because it contains changes to the build system to
+  ;; allow building shared libraries.
+  (let ((commit "a048203a881f11f4b7b8df5fb563aec85522f8db"))
+    (package
+      (name "abseil-cpp")
+      (version (string-append "20190808-" (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/abseil/abseil-cpp.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "13v3bkfyhrcl9am0jcz4cfbfc5rn3acm9z4wm01pn36vcgvw2l4s"))))
+      (build-system cmake-build-system)
+      (arguments `(#:configure-flags (list "-DBUILD_SHARED_LIBS=ON")
+                   #:tests? #f)) ; Tests attempt to download googletest.
+      (home-page "https://abseil.io")
+      (synopsis "Augmented C++ standard library")
+      (description "Abseil is an open-source collection of C++ library code
+designed to augment the C++ standard library.  The Abseil library code is
+collected from Google's own C++ code base, has been extensively tested and
+used in production, and is the same code we depend on in our daily coding
+lives.")
+      (license license:asl2.0))))
+
 ;; Note that Tensorflow includes a "third_party" directory, which seems to not
 ;; only contain modified subsets of upstream library source code, but also
 ;; adapter headers provided by Google (such as the fft.h header, which is not
-- 
2.17.1