about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-10-11 11:34:10 +0000
committerPjotr <wrk@bosa.lan>2026-10-11 11:34:10 +0000
commit8e13f31ceca05aa06b8a98b76e1141763b6a4140 (patch)
tree2703626c8a139b5091d148fd5db7083d70387be2
parentab13b3dcca0d832434e190bd716b213e6d8d64f0 (diff)
downloadgenenetwork4-8e13f31ceca05aa06b8a98b76e1141763b6a4140.tar.gz
guix: build xapian-rs with libclang 13, not 22
autocxx-bindgen with libclang 22 mis-parses Xapian 1.4.29: the C++ it
generates for xapian-rs instantiates the abstract Xapian::Weight (via
a bogus std::vector<Xapian::Weight> bridge) and emits an out-of-scope
'::op', so the build failed in the cargo build phase.  The xapian-rs
fork was built (and target/ produced) with libclang 13.0.1, whose
parse is correct.  Depend on clang-13 and point LIBCLANG_PATH at it in
the set-duckdb-paths phase.  (clang-13's package name is "clang", so
it replaces the clang-22 input rather than colliding with it.)

Also create the scratch directory in tests/embedded.rs: the SQLite test
opened test.db under a directory that did not exist yet.

guix build -f guix.scm now completes end to end (Rust check phase and
the Python REST suite), producing
/gnu/store/3avgh789ffy3lrfiql334dghp9sa4sqd-genenetwork4-git-0.1.0.
-rw-r--r--guix.scm19
-rw-r--r--tests/embedded.rs1
2 files changed, 16 insertions, 4 deletions
diff --git a/guix.scm b/guix.scm
index ccca73e..972bdb5 100644
--- a/guix.scm
+++ b/guix.scm
@@ -14,7 +14,7 @@
   (guix gexp)
   (guix packages)
   (guix build-system cargo)
-  (gnu packages llvm)      ; clang: libclang for autocxx codegen
+  (gnu packages llvm)      ; clang-13: libclang for autocxx codegen
   (gnu packages databases) ; lmdb: embedded key/value store
   (gnu packages duckdb)    ; duckdb: embedded analytical store
   (gnu packages sqlite)    ; sqlite: embedded relational store
@@ -68,10 +68,16 @@
                ;; falls back to a link-library request with no search path.
                (add-after 'configure 'set-duckdb-paths
                  (lambda* (#:key inputs #:allow-other-keys)
-                   (let ((duckdb (assoc-ref inputs "duckdb")))
+                   (let ((duckdb (assoc-ref inputs "duckdb"))
+                         (clang13 (assoc-ref inputs "clang")))
                      (setenv "DUCKDB_LIB_DIR" (string-append duckdb "/lib"))
                      (setenv "DUCKDB_INCLUDE_DIR"
-                             (string-append duckdb "/include")))))
+                             (string-append duckdb "/include"))
+                     ;; autocxx-bindgen picks libclang up from
+                     ;; LIBCLANG_PATH; without this it finds clang 22's,
+                     ;; whose Xapian parse breaks the xapian-rs build.
+                     (setenv "LIBCLANG_PATH"
+                             (string-append clang13 "/lib")))))
                (replace 'patch-cargo-checksums
                  (lambda* (#:key source #:allow-other-keys)
                    (let* ((rev "97fd34373e8f32f747f29d981271d6ec47643481")
@@ -157,7 +163,12 @@ replace-with = 'vendored-sources'
     (native-inputs
      (list git-minimal
            python
-           clang
+           ;; autocxx-bindgen must use libclang 13, not 22: clang 22
+           ;; mis-parses Xapian 1.4.29 and the generated C++
+           ;; instantiates the abstract Xapian::Weight (and emits a
+           ;; bogus ::op).  See set-duckdb-paths.  (clang-13's package
+           ;; name is "clang", so it carries the "clang" label.)
+           clang-13
            pkg-config
            rust-adler2-2.0.1
            rust-aho-corasick-1.1.5
diff --git a/tests/embedded.rs b/tests/embedded.rs
index bca2d3f..40a0529 100644
--- a/tests/embedded.rs
+++ b/tests/embedded.rs
@@ -14,6 +14,7 @@ fn scratch(tag: &str) -> PathBuf {
         std::process::id()
     ));
     let _ = std::fs::remove_dir_all(&dir);
+    std::fs::create_dir_all(&dir).expect("create scratch dir");
     dir
 }