summary refs log tree commit diff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2019-03-29 17:06:00 +0300
committerEfraim Flashner <efraim@flashner.co.il>2019-03-29 17:08:02 +0300
commit3776dc094cdcf3836501ac8c783092461e7f1e66 (patch)
tree7de7ac512c33015a012717d5c7117464ca466ea2
parent4774677228689df7c56efedc55c6ee06cd1e172d (diff)
downloadguix-3776dc094cdcf3836501ac8c783092461e7f1e66.tar.gz
gnu: faiss: Fix building on non-Intel architectures.
* gnu/packages/graph.scm (faiss)[source]: Add snippet to wrap Intel
specific headers.
[arguments]: Adjust custom 'prepare-build phase to adjust compile flags
for different architectures.
-rw-r--r--gnu/packages/graph.scm16
1 files changed, 13 insertions, 3 deletions
diff --git a/gnu/packages/graph.scm b/gnu/packages/graph.scm
index 2e8f7c1331..216b48195d 100644
--- a/gnu/packages/graph.scm
+++ b/gnu/packages/graph.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -256,7 +257,14 @@ subplots, multiple-axes, polar charts, and bubble charts. ")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0pk15jfa775cy2pqmzq62nhd6zfjxmpvz5h731197c28aq3zw39w"))))
+                "0pk15jfa775cy2pqmzq62nhd6zfjxmpvz5h731197c28aq3zw39w"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (substitute* "utils.cpp"
+                    (("#include <immintrin.h>")
+                     "#ifdef __SSE__\n#include <immintrin.h>\n#endif"))
+                  #t))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
@@ -270,12 +278,14 @@ subplots, multiple-axes, polar charts, and bubble charts. ")
                                                        (%current-system))))
                                        (cond
                                         ((string-prefix? "x86_64" system)
-                                         '("-mavx" "-msse2"))
+                                         '("-mavx" "-msse2" "-mpopcnt"))
                                         ((string-prefix? "i686" system)
-                                         '("-msse2"))
+                                         '("-msse2" "-mpopcnt"))
                                         (else
                                          '()))))))
                (substitute* "CMakeLists.txt"
+                 (("-m64") "")
+                 (("-mpopcnt") "") ; only some architectures
                  (("-msse4")
                   (string-append
                    (string-join features)