Subject: [bug#31479] [PATCH 3/3] gnu: Update shogun to 6.1.3.

From: Kei Kebreau <[email-masked]>
Date: Fri, 18 May 2018 13:08:57 -0400

Jonathan Brielmaier <[email-masked]> writes:

> On 17/05/2018 13:39, Jonathan Brielmaier wrote:
>> On 17/05/2018 01:24, Kei Kebreau wrote:
>>>
>>> These patches are really just to upgrade Octave, but the old Shogun
>>> couldn't find the new version of Octave. The shogun update patch is a
>>> WIP, but I don't have enough RAM (only 3.8GB) to make it through Shogun's
>>> build process reliably. Could someone else help out with this patch?
>>>
>> 
>> I build shogun now, lets see how it goes :)
>
> Unfortunately there was a build error for shogun. I attached the build
> log where it fails. It has something to do with the eigen library...
>
>
>
> $ /pre-inst-env guix build shogun
> [...]
> [ 50%] Building CXX object src/shogun/CMakeFiles/libshogun.dir/mathematics/linalg/ratapprox/logdet/opfunc/DenseMatrixExactLog.cpp.o
> cd /tmp/guix-build-shogun-6.1.3.drv-0/build/src/shogun && /gnu/store/cfdn69spjc44x4sd0acrwhxq6yay3rbc-gcc-5.5.0/bin/c++    -I/tmp/guix-build-shogun-6.1.3.drv-0/shogun-6.1.3/src -I/tmp/guix-build-shogun-6.1.3.drv-0/build/src -I/tmp/guix-build-shogun-6.1.3.drv-0/shogun-6.1.3/src/gpl -isystem /gnu/store/iwzn3vhwmzkvhq7sqs6c4bjp2xld17kc-eigen-3.3.4/include/eigen3 -isystem /gnu/store/5s9am1dgn83wj5q5kwfcasqws8zd85zz-rxcpp-4.0.0 -I/gnu/store/mllyvfy39npzra984jsmcm8ksn3x8094-glpk-4.65/include -I/gnu/store/wnw0gv5hgmhlw3jz1pgw4n017bhj9f2z-arpack-ng-3.5.0/lib/../include -I/gnu/store/mv9m6bxdhijhlfvxpja3km6v599b4pv5-libxml2-2.9.7/include/libxml2 -I/gnu/store/27jrvwbg5xa9la6jwnqz6ys4k7pfyykl-hdf5-1.8.19/include -I/gnu/store/9hd38bkw8bq8gq6lcv6vd8xjpcsbyzlm-zlib-1.2.11/include -I/gnu/store/77l8sxh9py133cy1p9kypshji4q9wv0w-bzip2-1.0.6/include -I/gnu/store/kgaf671a9a76k0ql1pwwjxjbj80x22mj-xz-5.2.3/include -I/gnu/store/33m86ycak50vh2p0q7qb0byh990hrkjn-lzo-2.10/include  -Wall -Wno-unused-parameter -Wformat -Wformat-security -Wparentheses -Wshadow -Wno-unknown-pragmas -Wno-deprecated  -O2 -g -DNDEBUG -fPIC   -fopenmp -std=c++11 -o CMakeFiles/libshogun.dir/mathematics/linalg/ratapprox/logdet/opfunc/DenseMatrixExactLog.cpp.o -c /tmp/guix-build-shogun-6.1.3.drv-0/shogun-6.1.3/src/shogun/mathematics/linalg/ratapprox/logdet/opfunc/DenseMatrixExactLog.cpp
> /tmp/guix-build-shogun-6.1.3.drv-0/shogun-6.1.3/src/shogun/mathematics/linalg/ratapprox/logdet/opfunc/DenseMatrixExactLog.cpp:15:45: fatal error: unsupported/Eigen/MatrixFunctions: No such file or directory
> compilation terminated.
> make[2]: *** [src/shogun/CMakeFiles/libshogun.dir/build.make:11456: src/shogun/CMakeFiles/libshogun.dir/mathematics/linalg/ratapprox/logdet/opfunc/DenseMatrixExactLog.cpp.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[2]: Leaving directory '/tmp/guix-build-shogun-6.1.3.drv-0/build'
> make[1]: *** [CMakeFiles/Makefile2:126: src/shogun/CMakeFiles/libshogun.dir/all] Error 2
> make[1]: Leaving directory '/tmp/guix-build-shogun-6.1.3.drv-0/build'
> make: *** [Makefile:153: all] Error 2
> phase `build' failed after 493.7 seconds
> builder for `/gnu/store/mjnmhzdx6zmwcvspmljsrjw2aazfvnv7-shogun-6.1.3.drv' failed with exit code 1
> @ build-failed /gnu/store/mjnmhzdx6zmwcvspmljsrjw2aazfvnv7-shogun-6.1.3.drv - 1 builder for `/gnu/store/mjnmhzdx6zmwcvspmljsrjw2aazfvnv7-shogun-6.1.3.drv' failed with exit code 1
> guix build: error: build failed: build of `/gnu/store/mjnmhzdx6zmwcvspmljsrjw2aazfvnv7-shogun-6.1.3.drv' failed

So it turns out that Eigen's source code comes with some functions that
are officially unsupported by the developers but still available for
use. Guix just doesn't install them. I've attached a patch that *should*
properly install the unsupported files to Eigen's include path.

Also, thanks for helping with this shogun patch!

From eed3dcce3714bc16ccb378d261d9e1bd8db3c249 Mon Sep 17 00:00:00 2001
From: Kei Kebreau <[email-masked]>
Date: Fri, 18 May 2018 12:46:57 -0400
Subject: [PATCH 3/4] gnu: eigen: Install unsupported header files.

* gnu/packages/algebra.scm (eigen)[arguments]: Add 'install-unsupported' phase.
Use invoke instead of system*.
---
 gnu/packages/algebra.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 03a61be47..51be58ee2 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -750,6 +750,14 @@ Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
        #:build-type "Release"
 
        #:phases (modify-phases %standard-phases
+                  (add-after 'install 'install-unsupported
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((out (assoc-ref outputs "out"))
+                             (include (string-append out "/include/eigen3")))
+                        (copy-recursively "unsupported"
+                                          (string-append include
+                                                         "/unsupported"))
+                        #t)))
                   (replace 'check
                     (lambda _
                       (let* ((cores  (parallel-job-count))
@@ -757,11 +765,11 @@ Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
 			(setenv "EIGEN_SEED" "1") ;for reproducibility
                         ;; First build the tests, in parallel.  See
                         ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
-                        (and (zero? (system* "make" "buildtests" dash-j))
+                        (and (invoke "make" "buildtests" dash-j)
 
                              ;; Then run 'CTest' with -V so we get more
                              ;; details upon failure.
-                             (zero? (system* "ctest" "-V" dash-j)))))))))
+                             (invoke "ctest" "-V" dash-j))))))))
     (home-page "http://eigen.tuxfamily.org")
     (synopsis "C++ template library for linear algebra")
     (description
-- 
2.17.0