unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54235] [PATCH 0/3] Add sysbench.
@ 2022-03-03 13:53 Maxim Cournoyer
  2022-03-03 14:05 ` [bug#54235] [PATCH 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-03 13:53 UTC (permalink / raw)
  To: 54235; +Cc: Maxim Cournoyer

Hello Guix!  This small series adds sysbench, which is supposed to be a
simpler alternative to fio.  You can try it like so:

--8<---------------cut here---------------start------------->8---
$ mkdir /tmp/sysbench-test && cd /tmp/sysbench-test
$ sysbench fileio prepare
[...]
$ sysbench fileio --file-test-mode=rndrw run
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!


File operations:
    reads/s:                      11.51
    writes/s:                     7.67
    fsyncs/s:                     36.64

Throughput:
    read, MiB/s:                  0.18
    written, MiB/s:               0.12

General statistics:
    total time:                          10.4215s
    total number of events:              454

Latency (ms):
         min:                                    0.00
         avg:                                   22.11
         max:                                  333.26
         95th percentile:                       70.55
         sum:                                10040.07

Threads fairness:
    events (avg/stddev):           454.0000/0.00
    execution time (avg/stddev):   10.0401/0.00
--8<---------------cut here---------------end--------------->8---

Thanks,

Maxim Cournoyer (3):
  gnu: docbook-xml-4.1.2: Install an XML catalog file.
  gnu: Add ck.
  gnu: Add sysbench.

 gnu/packages/benchmark.scm | 140 ++++++++++++++++++++++++++++++++++++-
 gnu/packages/c.scm         |  39 +++++++++++
 gnu/packages/docbook.scm   |  26 ++++---
 3 files changed, 196 insertions(+), 9 deletions(-)

-- 
2.34.0





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

* [bug#54235] [PATCH 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file.
  2022-03-03 13:53 [bug#54235] [PATCH 0/3] Add sysbench Maxim Cournoyer
@ 2022-03-03 14:05 ` Maxim Cournoyer
  2022-03-03 14:05   ` [bug#54235] [PATCH 2/3] gnu: Add ck Maxim Cournoyer
  2022-03-03 14:05   ` [bug#54235] [PATCH 3/3] gnu: Add sysbench Maxim Cournoyer
  2022-03-08  4:38 ` [bug#54235] [PATCH v2 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2022-03-08 14:36 ` [bug#54235] [PATCH v3 1/4] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2 siblings, 2 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-03 14:05 UTC (permalink / raw)
  To: 54235; +Cc: Maxim Cournoyer

* gnu/packages/docbook.scm (docbook-xml-4.1.2)[builder]: Generate a catalog
file.
[native-inputs]: Add libxml2.
---
 gnu/packages/docbook.scm | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index cb1a0d4d5e..6b1c533609 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
@@ -153,7 +153,8 @@ (define-public docbook-xml-4.2
                 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
 
 (define-public docbook-xml-4.1.2
-  (package (inherit docbook-xml)
+  (package
+    (inherit docbook-xml)
     (version "4.1.2")
     (source (origin
               (method url-fetch)
@@ -167,13 +168,22 @@ (define-public docbook-xml-4.1.2
        #:builder
        (begin
          (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (unzip  (string-append (assoc-ref %build-inputs "unzip")
-                                      "/bin/unzip"))
-               (dtd    (string-append (assoc-ref %outputs "out")
-                                      "/xml/dtd/docbook")))
+         (let* ((source (assoc-ref %build-inputs "source"))
+                (unzip  (string-append (assoc-ref %build-inputs "unzip")
+                                       "/bin/unzip"))
+                (xmlcatalog  (string-append (assoc-ref %build-inputs "libxml2")
+                                            "/bin/xmlcatalog"))
+                (dtd    (string-append (assoc-ref %outputs "out")
+                                       "/xml/dtd/docbook"))
+                (catalog.xml (string-append dtd "/catalog.xml")))
            (mkdir-p dtd)
-           (invoke unzip source "-d" dtd)))))))
+           (invoke unzip source "-d" dtd)
+           ;; Create a minimal XML catalog, to use with libxml2 tools.
+           (invoke xmlcatalog "--noout" "--create" catalog.xml)
+           (invoke xmlcatalog "--noout" "--add" "public"
+                   "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   (string-append dtd "/docbookx.dtd") catalog.xml)))))
+    (native-inputs (list libxml2 unzip))))
 
 (define-public docbook-xsl
   (package
-- 
2.34.0





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

* [bug#54235] [PATCH 2/3] gnu: Add ck.
  2022-03-03 14:05 ` [bug#54235] [PATCH 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
@ 2022-03-03 14:05   ` Maxim Cournoyer
  2022-03-03 16:55     ` Maxime Devos
  2022-03-03 14:05   ` [bug#54235] [PATCH 3/3] gnu: Add sysbench Maxim Cournoyer
  1 sibling, 1 reply; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-03 14:05 UTC (permalink / raw)
  To: 54235; +Cc: Maxim Cournoyer

* gnu/packages/c.scm (ck): New variable.
---
 gnu/packages/c.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index e53a7c865f..613f3c504e 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -896,6 +896,45 @@ (define-public aws-c-mqtt
     (home-page "https://github.com/awslabs/aws-c-mqtt")
     (license license:asl2.0)))
 
+(define-public ck
+  (package
+    (name "ck")
+    (version "0.7.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/concurrencykit/ck")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "020yzfpvymdc8lc44znlnxmxb8mvp42g4nb4p8k814klazqvwh0x"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'configure
+            ;; ck uses a custom configure script that stumbles on
+            ;; '--enable-fast-install'.
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (invoke "./configure"
+                      (string-append "--prefix=" #$output)
+                      (string-append "--mandir=" #$output "/share/man")
+                      "--use-cc-builtins"
+                      (string-append "--cores="
+                                     (if parallel-build?
+                                         (number->string (parallel-job-count))
+                                         "1"))))))))
+    (home-page "https://github.com/concurrencykit/ck")
+    (synopsis "C library for concurrent systems")
+    (description "Concurrency Kit (@code{ck}) provides concurrency primitives,
+safe memory reclamation mechanisms and non-blocking (including lock-free) data
+structures designed to aid in the research, design and implementation of high
+performance concurrent systems developed in C99+.")
+    (license (list license:bsd-2        ;everything except...
+                   license:asl2.0))))   ;src/ck_hp.c
+
 (define-public utf8-h
   ;; The latest tag is used as there is no release.
   (let ((commit "500d4ea9f4c3449e5243c088d8af8700f7189734")
-- 
2.34.0





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

* [bug#54235] [PATCH 3/3] gnu: Add sysbench.
  2022-03-03 14:05 ` [bug#54235] [PATCH 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2022-03-03 14:05   ` [bug#54235] [PATCH 2/3] gnu: Add ck Maxim Cournoyer
@ 2022-03-03 14:05   ` Maxim Cournoyer
  2022-03-03 16:42     ` Maxime Devos
  1 sibling, 1 reply; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-03 14:05 UTC (permalink / raw)
  To: 54235; +Cc: Maxim Cournoyer

* gnu/packages/benchmark.scm (sysbench): New variable.
---
 gnu/packages/benchmark.scm | 140 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 139 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/benchmark.scm b/gnu/packages/benchmark.scm
index 537f6262c4..69de11d998 100644
--- a/gnu/packages/benchmark.scm
+++ b/gnu/packages/benchmark.scm
@@ -8,7 +8,7 @@
 ;;; Copyright © 2019, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2020 malte Frank Gerdes <malte.f.gerdes@gmail.com>
-;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020 Greg Hogan <code@greghogan.com>
 ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
@@ -31,22 +31,31 @@ (define-module (gnu packages benchmark)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages c)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages docbook)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lua)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages opencl)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
 (define-public fio
@@ -383,3 +392,132 @@ (define-public clpeak
         devices.  It only measures the peak metrics that can be achieved using
         vector operations and does not represent a real-world use case.")
         (license license:unlicense))))
+
+(define-public sysbench
+  (package
+    (name "sysbench")
+    (version "1.0.20")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/akopytov/sysbench")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; Ensure no bundled libraries get used.
+                          (delete-file-recursively "third_party")
+                          (substitute* "configure.ac"
+                            (("^third_party/.*")
+                             ""))
+                          (substitute* "Makefile.am"
+                            ((".*(LUAJIT|CK)_DIR =.*")
+                             ""))))
+              (sha256
+               (base32
+                "1sanvl2a52ff4shj62nw395zzgdgywplqvwip74ky8q7s6qjf5qy"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:configure-flags #~(list "--with-pgsql"
+                                ;; Explicitly specify the library directory of
+                                ;; MySQL, otherwise `mysql_config` gets
+                                ;; consulted and adds unnecessary link
+                                ;; directives.
+                                (string-append "--with-mysql-libs="
+                                               #$(this-package-input "mysql")
+                                               "/lib")
+                                "--with-system-luajit"
+                                "--with-system-ck"
+                                ;; If we let the build tool select the most
+                                ;; optimal compiler architecture flag, the
+                                ;; build is not reproducible.
+                                "--without-gcc-arch")
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-test-runner
+                     (lambda _
+                       (substitute* "tests/test_run.sh"
+                         (("/bin/bash")
+                          (which "bash"))
+                         ;; Do not attempt to invoke the cram command via
+                         ;; Python, as on Guix it is a shell script (wrapper).
+                         (("\\$\\(command -v cram\\)")
+                          "-m cram"))))
+                   (add-after 'unpack 'disable-test-installation
+                     (lambda _
+                       (substitute* "tests/Makefile.am"
+                         (("install-data-local")
+                          "do-not-install-data-local")
+                         (("^test_SCRIPTS.*")
+                          ""))))
+                   (add-after 'unpack 'fix-docbook
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (substitute* "m4/ax_check_docbook.m4"
+                         (("DOCBOOK_ROOT=.*" all)
+                          (string-append
+                           all "XML_CATALOG="
+                           (search-input-file inputs
+                                              "xml/dtd/docbook/catalog.xml")
+                           "\n")))
+                       (substitute* "doc/xsl/xhtml.xsl"
+                         (("http://docbook.sourceforge.net/release/xsl\
+/current/xhtml/docbook.xsl")
+                          (search-input-file
+                           inputs (string-append "xml/xsl/docbook-xsl-"
+                                                 #$(package-version docbook-xsl)
+                                                 "/xhtml/docbook.xsl"))))
+                       (substitute* "doc/xsl/xhtml-chunk.xsl"
+                         (("http://docbook.sourceforge.net/release/xsl\
+/current/xhtml/chunk.xsl")
+                          (search-input-file
+                           inputs (string-append "xml/xsl/docbook-xsl-"
+                                                 #$(package-version docbook-xsl)
+                                                 "/xhtml/chunk.xsl")))))))))
+    (native-inputs (list autoconf
+                         automake
+                         libtool
+                         pkg-config
+                         python-cram
+                         python-wrapper
+                         which
+                         ;; For documentation
+                         libxml2        ;for XML_CATALOG_FILES
+                         libxslt
+                         docbook-xml-4.1.2
+                         docbook-xsl))
+    (inputs (list ck libaio luajit mysql postgresql))
+    (home-page "https://github.com/akopytov/sysbench/")
+    (synopsis "Scriptable database and system performance benchmark")
+    (description "@command{sysbench} is a scriptable multi-threaded benchmark
+tool based on LuaJIT.  It is most frequently used for database benchmarks, but
+can also be used to create arbitrarily complex workloads that do not involve a
+database server.  @command{sysbench} comes with the following bundled
+benchmarks:
+@table @file
+@item oltp_*.lua
+A collection of OLTP-like database benchmarks.
+@item fileio
+A filesystem-level benchmark.
+@item cpu
+A simple CPU benchmark.
+@item memory
+A memory access benchmark.
+@item threads
+A thread-based scheduler benchmark.
+@item mutex
+A POSIX mutex benchmark.
+@end table
+It includes features such as:
+@itemize
+@item
+Extensive statistics about rate and latency is available, including latency
+percentiles and histograms.
+@item
+Low overhead even with thousands of concurrent threads.  @command{sysbench} is
+capable of generating and tracking hundreds of millions of events per second.
+@item
+New benchmarks can be easily created by implementing pre-defined hooks in
+user-provided Lua scripts.
+@item
+@end itemize")
+    (license license:gpl2+)))
-- 
2.34.0





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

* [bug#54235] [PATCH 3/3] gnu: Add sysbench.
  2022-03-03 14:05   ` [bug#54235] [PATCH 3/3] gnu: Add sysbench Maxim Cournoyer
@ 2022-03-03 16:42     ` Maxime Devos
  2022-03-07 18:59       ` Maxim Cournoyer
  0 siblings, 1 reply; 28+ messages in thread
From: Maxime Devos @ 2022-03-03 16:42 UTC (permalink / raw)
  To: Maxim Cournoyer, 54235

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

Maxim Cournoyer schreef op do 03-03-2022 om 09:05 [-0500]:
> +              (snippet '(begin
> +                          ;; Ensure no bundled libraries get used.
> +                          (delete-file-recursively "third_party")
> +                          (substitute* "configure.ac"
> +                            (("^third_party/.*")
> +                             ""))
> +                          (substitute* "Makefile.am"
> +                            ((".*(LUAJIT|CK)_DIR =.*")
> +                             ""))))

For consistency with the code below, I would make this a gexp, YMMV.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54235] [PATCH 2/3] gnu: Add ck.
  2022-03-03 14:05   ` [bug#54235] [PATCH 2/3] gnu: Add ck Maxim Cournoyer
@ 2022-03-03 16:55     ` Maxime Devos
  2022-03-07 18:57       ` Maxim Cournoyer
  0 siblings, 1 reply; 28+ messages in thread
From: Maxime Devos @ 2022-03-03 16:55 UTC (permalink / raw)
  To: Maxim Cournoyer, 54235

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

Maxim Cournoyer schreef op do 03-03-2022 om 09:05 [-0500]:
> +          (replace 'configure
> +            ;; ck uses a custom configure script that stumbles on
> +            ;; '--enable-fast-install'.
> +            (lambda* (#:key parallel-build? #:allow-other-keys)
> +              (invoke "./configure"
> +                      (string-append "--prefix=" #$output)
> +                      (string-append "--mandir=" #$output "/share/man")
> +                      "--use-cc-builtins"
> +                      (string-append "--cores="
> +                                     (if parallel-build?
> +                                         (number->string (parallel-job-count))
> +                                         "1"))))))))

For cross-compilation support, it seems that the CC environment
variable needs to be set (and possibly AR and LD as well).

Also, the configure script looks in /proc/cpuinfo for ‘address sizes’
and ‘VMA bits’, there might be some reproducibility and cross-
compilation concerns there.

The configure script enables SSE things by default (on x86-32).  I
don't know if that can be assumed in Guix.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54235] [PATCH 2/3] gnu: Add ck.
  2022-03-03 16:55     ` Maxime Devos
@ 2022-03-07 18:57       ` Maxim Cournoyer
  2022-03-07 20:57         ` Maxime Devos
  0 siblings, 1 reply; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-07 18:57 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op do 03-03-2022 om 09:05 [-0500]:
>> +          (replace 'configure
>> +            ;; ck uses a custom configure script that stumbles on
>> +            ;; '--enable-fast-install'.
>> +            (lambda* (#:key parallel-build? #:allow-other-keys)
>> +              (invoke "./configure"
>> +                      (string-append "--prefix=" #$output)
>> +                      (string-append "--mandir=" #$output "/share/man")
>> +                      "--use-cc-builtins"
>> +                      (string-append "--cores="
>> +                                     (if parallel-build?
>> +                                         (number->string (parallel-job-count))
>> +                                         "1"))))))))
>
> For cross-compilation support, it seems that the CC environment
> variable needs to be set (and possibly AR and LD as well).

It seems to be handled alright as it is; at least I was able to build
with:

./pre-inst-env guix build --target=arm-linux-gnueabihf ck
[...]
done with offloaded '/gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv'
successfully built /gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv
/gnu/store/n6ipif548pxk0319kpchpxa7h5z6pzcm-ck-0.7.1

> Also, the configure script looks in /proc/cpuinfo for ‘address sizes’
> and ‘VMA bits’, there might be some reproducibility and cross-
> compilation concerns there.

I haven't seen nondetermism in the builds between x86_64 host of very
different architecture (Core 2 Duo from 2007 vs a recent Ryzen).

> The configure script enables SSE things by default (on x86-32).  I
> don't know if that can be assumed in Guix.

SSE was introduced with the Pentium III line in 1999.  I'd think that's
old enough to assume it's available for x86 machines.

Thanks for taking a look and paying attention to these tricky issues.
With my observations above, does it look good to you?

Thanks,

Maxim

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

* [bug#54235] [PATCH 3/3] gnu: Add sysbench.
  2022-03-03 16:42     ` Maxime Devos
@ 2022-03-07 18:59       ` Maxim Cournoyer
  0 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-07 18:59 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op do 03-03-2022 om 09:05 [-0500]:
>> +              (snippet '(begin
>> +                          ;; Ensure no bundled libraries get used.
>> +                          (delete-file-recursively "third_party")
>> +                          (substitute* "configure.ac"
>> +                            (("^third_party/.*")
>> +                             ""))
>> +                          (substitute* "Makefile.am"
>> +                            ((".*(LUAJIT|CK)_DIR =.*")
>> +                             ""))))
>
> For consistency with the code below, I would make this a gexp, YMMV.

I think I prefer to leave it as is, to readily convey that no G-Exp
features were used.

Thank you!

Maxim

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

* [bug#54235] [PATCH 2/3] gnu: Add ck.
  2022-03-07 18:57       ` Maxim Cournoyer
@ 2022-03-07 20:57         ` Maxime Devos
  2022-03-08  1:47           ` Maxim Cournoyer
  2022-03-08  4:06           ` Maxim Cournoyer
  0 siblings, 2 replies; 28+ messages in thread
From: Maxime Devos @ 2022-03-07 20:57 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 54235

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

Maxim Cournoyer schreef op ma 07-03-2022 om 13:57 [-0500]:
> It seems to be handled alright as it is; at least I was able to build
> with:
> 
> ./pre-inst-env guix build --target=arm-linux-gnueabihf ck
> [...]
> done with offloaded '/gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv'
> successfully built /gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv
> /gnu/store/n6ipif548pxk0319kpchpxa7h5z6pzcm-ck-0.7.1

Unfortunately, that is a rather unreliable check.
This only checks that 'ck' could be compiled, but it does not check
that 'ck' was actually compiled for arm-linux-gnueabihf instead of
(%current-system).  It might still be the case that 'gcc' is used
instead of '$TARGET-gcc'

Could you run 'file' against /gnu/store/[...]/bin/* to verify things?
On my x86-64-linux-gnu system, for a native binary, I get:

a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
linked, interpreter /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-
2.33/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

I'm not sure what you would get for an arm-linux-gnueabihf but it
probably should not include '64-bit' or 'x86-64'.

Assuming you have QEMU emulation _disabled_, you can also try running
the binary on your (presumably non-arm) system and verify that it fails
to start.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54235] [PATCH 2/3] gnu: Add ck.
  2022-03-07 20:57         ` Maxime Devos
@ 2022-03-08  1:47           ` Maxim Cournoyer
  2022-03-08  4:06           ` Maxim Cournoyer
  1 sibling, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08  1:47 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op ma 07-03-2022 om 13:57 [-0500]:
>> It seems to be handled alright as it is; at least I was able to build
>> with:
>> 
>> ./pre-inst-env guix build --target=arm-linux-gnueabihf ck
>> [...]
>> done with offloaded '/gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv'
>> successfully built /gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv
>> /gnu/store/n6ipif548pxk0319kpchpxa7h5z6pzcm-ck-0.7.1
>
> Unfortunately, that is a rather unreliable check.
> This only checks that 'ck' could be compiled, but it does not check
> that 'ck' was actually compiled for arm-linux-gnueabihf instead of
> (%current-system).  It might still be the case that 'gcc' is used
> instead of '$TARGET-gcc'
>
> Could you run 'file' against /gnu/store/[...]/bin/* to verify things?
> On my x86-64-linux-gnu system, for a native binary, I get:
>
> a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
> linked, interpreter /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-
> 2.33/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped
>
> I'm not sure what you would get for an arm-linux-gnueabihf but it
> probably should not include '64-bit' or 'x86-64'.

Good catch, you are right:

--8<---------------cut here---------------start------------->8---
$ file /gnu/store/n6ipif548pxk0319kpchpxa7h5z6pzcm-ck-0.7.1/lib/libck.so.0.7.1 
/gnu/store/n6ipif548pxk0319kpchpxa7h5z6pzcm-ck-0.7.1/lib/libck.so.0.7.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
--8<---------------cut here---------------end--------------->8---

I'll be sending a V2 once I've fixed cross-compilation.  Another -1 for
custom/borked configure script, eh!

Thanks,

Maxim




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

* [bug#54235] [PATCH 2/3] gnu: Add ck.
  2022-03-07 20:57         ` Maxime Devos
  2022-03-08  1:47           ` Maxim Cournoyer
@ 2022-03-08  4:06           ` Maxim Cournoyer
  1 sibling, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08  4:06 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op ma 07-03-2022 om 13:57 [-0500]:
>> It seems to be handled alright as it is; at least I was able to build
>> with:
>> 
>> ./pre-inst-env guix build --target=arm-linux-gnueabihf ck
>> [...]
>> done with offloaded '/gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv'
>> successfully built /gnu/store/m1gv4a1q9cv3ig9v4bymb9wd9l6g93y3-ck-0.7.1.drv
>> /gnu/store/n6ipif548pxk0319kpchpxa7h5z6pzcm-ck-0.7.1
>
> Unfortunately, that is a rather unreliable check.
> This only checks that 'ck' could be compiled, but it does not check
> that 'ck' was actually compiled for arm-linux-gnueabihf instead of
> (%current-system).  It might still be the case that 'gcc' is used
> instead of '$TARGET-gcc'
>
> Could you run 'file' against /gnu/store/[...]/bin/* to verify things?
> On my x86-64-linux-gnu system, for a native binary, I get:
>
> a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
> linked, interpreter /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-
> 2.33/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped
>
> I'm not sure what you would get for an arm-linux-gnueabihf but it
> probably should not include '64-bit' or 'x86-64'.
>
> Assuming you have QEMU emulation _disabled_, you can also try running
> the binary on your (presumably non-arm) system and verify that it fails
> to start.
>
> Greetings,
> Maxime.

I tried hard to have the custom configure script collaborating, but in
the end, it appears critically broken.  This is what I tried:

--8<---------------cut here---------------start------------->8---
1 file changed, 52 insertions(+), 9 deletions(-)
gnu/packages/c.scm | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------

modified   gnu/packages/c.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages c)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
+  #:use-module (guix store)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bootstrap)
@@ -916,16 +917,58 @@ (define-public ck
       #~(modify-phases %standard-phases
           (replace 'configure
             ;; ck uses a custom configure script that stumbles on
-            ;; '--enable-fast-install'.
+            ;; '--enable-fast-install', among other things.
             (lambda* (#:key parallel-build? #:allow-other-keys)
-              (invoke "./configure"
-                      (string-append "--prefix=" #$output)
-                      (string-append "--mandir=" #$output "/share/man")
-                      "--use-cc-builtins"
-                      (string-append "--cores="
-                                     (if parallel-build?
-                                         (number->string (parallel-job-count))
-                                         "1"))))))))
+              ;; TODO: Move AR-FOR-TARGET and LD-FOR-TARGET to (guix utils).
+              (define* (ar-for-target #:optional (target #$(%current-target-system)))
+                (if target
+                    (string-append target "-ar")
+                    "ar"))
+              (define* (ld-for-target #:optional (target #$(%current-target-system)))
+                (if target
+                    (string-append target "-ld")
+                    "ld"))
+              (define (gnu-triplet->machine target)
+                (letrec-syntax
+                    ((matches (syntax-rules (=>)
+                                ((_ (target-prefix => machine) rest ...)
+                                 (if (string-prefix? target-prefix target)
+                                     machine
+                                     (matches rest ...)))
+                                ((_)
+                                 (error "unsupported target" target)))))
+                  ;; This basically reproduces the logic handling the
+                  ;; PLATFORM variable in the configure script.
+                  (matches ("x86_64"      => "x86_64")
+                           ("i586"        => "x86")
+                           ("i686"        => "x86")
+                           ("aarch64"     => "aarch64")
+                           ("arm"         => "arm")
+                           ("ppc64"       => "ppc64")
+                           ("ppc"         => "ppc")
+                           ("s390x"       => "s390x")
+                           ("sparc64"     => "sparcv9"))))
+              (define target-machine (and=> #$(%current-target-system)
+                                            gnu-triplet->machine))
+              ;; The custom configure script doesn't make cross-compilation
+              ;; adjustments itself, so manually set the archiver, compiler
+              ;; and linker.  Even then, it is still broken and doesn't
+              ;; actually build any binary (see:
+              ;; https://github.com/concurrencykit/ck/issues/191).
+              (setenv "AR" (ar-for-target))
+              (setenv "CC" #$(cc-for-target))
+              (setenv "LD" (ld-for-target))
+              (setenv "LDFLAGS" "")
+              (apply invoke "./configure"
+                     `(,@(if target-machine
+                             (list (string-append "--profile=" target-machine))
+                             '())
+                       ,(string-append "--prefix=" #$output)
+                       ,(string-append "--mandir=" #$output "/share/man")
+                       ,(string-append "--cores="
+                                       (if parallel-build?
+                                           (number->string (parallel-job-count))
+                                           "1")))))))))
     (home-page "https://github.com/concurrencykit/ck")
     (synopsis "C library for concurrent systems")
     (description "Concurrency Kit (@code{ck}) provides concurrency primitives,
--8<---------------cut here---------------end--------------->8---

But due to the test setting COMPILER failing, it doesn't set any
ALL_LIBS and thus doesn't build anything (see:
https://github.com/concurrencykit/ck/issues/191).

I also tried patching COMPILER to hard-code it to gcc and export
COMPILER to gcc, but that doesn't work too; it seems the ordering of the
logic in script is wrong.

I'd still keep the changes in, which will make life easier if/when
upstream fixes their script.

Thanks,

Maxim




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

* [bug#54235] [PATCH v2 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file.
  2022-03-03 13:53 [bug#54235] [PATCH 0/3] Add sysbench Maxim Cournoyer
  2022-03-03 14:05 ` [bug#54235] [PATCH 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
@ 2022-03-08  4:38 ` Maxim Cournoyer
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 2/3] gnu: Add ck Maxim Cournoyer
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 3/3] gnu: Add sysbench Maxim Cournoyer
  2022-03-08 14:36 ` [bug#54235] [PATCH v3 1/4] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2 siblings, 2 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08  4:38 UTC (permalink / raw)
  To: 54235; +Cc: maximedevos, Maxim Cournoyer

* gnu/packages/docbook.scm (docbook-xml-4.1.2)[builder]: Generate a catalog
file.
[native-inputs]: Add libxml2.
---
 gnu/packages/docbook.scm | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 6575bf2d75..0a8d2e2aed 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
@@ -153,7 +153,8 @@ (define-public docbook-xml-4.2
                 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
 
 (define-public docbook-xml-4.1.2
-  (package (inherit docbook-xml)
+  (package
+    (inherit docbook-xml)
     (version "4.1.2")
     (source (origin
               (method url-fetch)
@@ -167,13 +168,22 @@ (define-public docbook-xml-4.1.2
        #:builder
        (begin
          (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (unzip  (string-append (assoc-ref %build-inputs "unzip")
-                                      "/bin/unzip"))
-               (dtd    (string-append (assoc-ref %outputs "out")
-                                      "/xml/dtd/docbook")))
+         (let* ((source (assoc-ref %build-inputs "source"))
+                (unzip  (string-append (assoc-ref %build-inputs "unzip")
+                                       "/bin/unzip"))
+                (xmlcatalog  (string-append (assoc-ref %build-inputs "libxml2")
+                                            "/bin/xmlcatalog"))
+                (dtd    (string-append (assoc-ref %outputs "out")
+                                       "/xml/dtd/docbook"))
+                (catalog.xml (string-append dtd "/catalog.xml")))
            (mkdir-p dtd)
-           (invoke unzip source "-d" dtd)))))))
+           (invoke unzip source "-d" dtd)
+           ;; Create a minimal XML catalog, to use with libxml2 tools.
+           (invoke xmlcatalog "--noout" "--create" catalog.xml)
+           (invoke xmlcatalog "--noout" "--add" "public"
+                   "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   (string-append dtd "/docbookx.dtd") catalog.xml)))))
+    (native-inputs (list libxml2 unzip))))
 
 (define-public docbook-xsl
   (package
-- 
2.34.0





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

* [bug#54235] [PATCH v2 2/3] gnu: Add ck.
  2022-03-08  4:38 ` [bug#54235] [PATCH v2 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
@ 2022-03-08  4:38   ` Maxim Cournoyer
  2022-03-08  9:39     ` Maxime Devos
                       ` (2 more replies)
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 3/3] gnu: Add sysbench Maxim Cournoyer
  1 sibling, 3 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08  4:38 UTC (permalink / raw)
  To: 54235; +Cc: maximedevos, Maxim Cournoyer

* gnu/packages/c.scm (ck): New variable.
---
 gnu/packages/c.scm | 81 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index e53a7c865f..5fc923790a 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages c)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
+  #:use-module (guix store)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bootstrap)
@@ -896,6 +897,86 @@ (define-public aws-c-mqtt
     (home-page "https://github.com/awslabs/aws-c-mqtt")
     (license license:asl2.0)))
 
+(define-public ck
+  (package
+    (name "ck")
+    (version "0.7.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/concurrencykit/ck")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "020yzfpvymdc8lc44znlnxmxb8mvp42g4nb4p8k814klazqvwh0x"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'configure
+            ;; ck uses a custom configure script that stumbles on
+            ;; '--enable-fast-install', among other things.
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              ;; TODO: Move AR-FOR-TARGET and LD-FOR-TARGET to (guix utils).
+              (define* (ar-for-target #:optional (target #$(%current-target-system)))
+                (if target
+                    (string-append target "-ar")
+                    "ar"))
+              (define* (ld-for-target #:optional (target #$(%current-target-system)))
+                (if target
+                    (string-append target "-ld")
+                    "ld"))
+              (define (gnu-triplet->machine target)
+                (letrec-syntax
+                    ((matches (syntax-rules (=>)
+                                ((_ (target-prefix => machine) rest ...)
+                                 (if (string-prefix? target-prefix target)
+                                     machine
+                                     (matches rest ...)))
+                                ((_)
+                                 (error "unsupported target" target)))))
+                  ;; This basically reproduces the logic handling the
+                  ;; PLATFORM variable in the configure script.
+                  (matches ("x86_64"      => "x86_64")
+                           ("i586"        => "x86")
+                           ("i686"        => "x86")
+                           ("aarch64"     => "aarch64")
+                           ("arm"         => "arm")
+                           ("ppc64"       => "ppc64")
+                           ("ppc"         => "ppc")
+                           ("s390x"       => "s390x")
+                           ("sparc64"     => "sparcv9"))))
+              (define target-machine (and=> #$(%current-target-system)
+                                            gnu-triplet->machine))
+              ;; The custom configure script doesn't make cross-compilation
+              ;; adjustments itself, so manually set the archiver, compiler
+              ;; and linker.  Even then, it is still broken and doesn't
+              ;; actually build any binary (see:
+              ;; https://github.com/concurrencykit/ck/issues/191).
+              (setenv "AR" (ar-for-target))
+              (setenv "CC" #$(cc-for-target))
+              (setenv "LD" (ld-for-target))
+              (apply invoke "./configure"
+                     `(,@(if target-machine
+                             (list (string-append "--profile=" target-machine))
+                             '())
+                       ,(string-append "--prefix=" #$output)
+                       ,(string-append "--mandir=" #$output "/share/man")
+                       ,(string-append "--cores="
+                                       (if parallel-build?
+                                           (number->string (parallel-job-count))
+                                           "1")))))))))
+    (home-page "https://github.com/concurrencykit/ck")
+    (synopsis "C library for concurrent systems")
+    (description "Concurrency Kit (@code{ck}) provides concurrency primitives,
+safe memory reclamation mechanisms and non-blocking (including lock-free) data
+structures designed to aid in the research, design and implementation of high
+performance concurrent systems developed in C99+.")
+    (license (list license:bsd-2        ;everything except...
+                   license:asl2.0))))   ;src/ck_hp.c
+
 (define-public utf8-h
   ;; The latest tag is used as there is no release.
   (let ((commit "500d4ea9f4c3449e5243c088d8af8700f7189734")
-- 
2.34.0





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

* [bug#54235] [PATCH v2 3/3] gnu: Add sysbench.
  2022-03-08  4:38 ` [bug#54235] [PATCH v2 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 2/3] gnu: Add ck Maxim Cournoyer
@ 2022-03-08  4:38   ` Maxim Cournoyer
  2022-03-08  9:42     ` Maxime Devos
  1 sibling, 1 reply; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08  4:38 UTC (permalink / raw)
  To: 54235; +Cc: maximedevos, Maxim Cournoyer

* gnu/packages/benchmark.scm (sysbench): New variable.
---
 gnu/packages/benchmark.scm | 137 +++++++++++++++++++++++++++++++++++++
 1 file changed, 137 insertions(+)

diff --git a/gnu/packages/benchmark.scm b/gnu/packages/benchmark.scm
index eb5df3d4c3..87c39aac8c 100644
--- a/gnu/packages/benchmark.scm
+++ b/gnu/packages/benchmark.scm
@@ -37,19 +37,27 @@ (define-module (gnu packages benchmark)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages c)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages kde-frameworks)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages docbook)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lua)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages opencl)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
 (define-public fio
@@ -430,3 +438,132 @@ (define-public kdiskmark
 @item Report generation.
 @end itemize")
     (license license:gpl3+)))
+
+(define-public sysbench
+  (package
+    (name "sysbench")
+    (version "1.0.20")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/akopytov/sysbench")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; Ensure no bundled libraries get used.
+                          (delete-file-recursively "third_party")
+                          (substitute* "configure.ac"
+                            (("^third_party/.*")
+                             ""))
+                          (substitute* "Makefile.am"
+                            ((".*(LUAJIT|CK)_DIR =.*")
+                             ""))))
+              (sha256
+               (base32
+                "1sanvl2a52ff4shj62nw395zzgdgywplqvwip74ky8q7s6qjf5qy"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:configure-flags #~(list "--with-pgsql"
+                                ;; Explicitly specify the library directory of
+                                ;; MySQL, otherwise `mysql_config` gets
+                                ;; consulted and adds unnecessary link
+                                ;; directives.
+                                (string-append "--with-mysql-libs="
+                                               #$(this-package-input "mysql")
+                                               "/lib")
+                                "--with-system-luajit"
+                                "--with-system-ck"
+                                ;; If we let the build tool select the most
+                                ;; optimal compiler architecture flag, the
+                                ;; build is not reproducible.
+                                "--without-gcc-arch")
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-test-runner
+                     (lambda _
+                       (substitute* "tests/test_run.sh"
+                         (("/bin/bash")
+                          (which "bash"))
+                         ;; Do not attempt to invoke the cram command via
+                         ;; Python, as on Guix it is a shell script (wrapper).
+                         (("\\$\\(command -v cram\\)")
+                          "-m cram"))))
+                   (add-after 'unpack 'disable-test-installation
+                     (lambda _
+                       (substitute* "tests/Makefile.am"
+                         (("install-data-local")
+                          "do-not-install-data-local")
+                         (("^test_SCRIPTS.*")
+                          ""))))
+                   (add-after 'unpack 'fix-docbook
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (substitute* "m4/ax_check_docbook.m4"
+                         (("DOCBOOK_ROOT=.*" all)
+                          (string-append
+                           all "XML_CATALOG="
+                           (search-input-file inputs
+                                              "xml/dtd/docbook/catalog.xml")
+                           "\n")))
+                       (substitute* "doc/xsl/xhtml.xsl"
+                         (("http://docbook.sourceforge.net/release/xsl\
+/current/xhtml/docbook.xsl")
+                          (search-input-file
+                           inputs (string-append "xml/xsl/docbook-xsl-"
+                                                 #$(package-version docbook-xsl)
+                                                 "/xhtml/docbook.xsl"))))
+                       (substitute* "doc/xsl/xhtml-chunk.xsl"
+                         (("http://docbook.sourceforge.net/release/xsl\
+/current/xhtml/chunk.xsl")
+                          (search-input-file
+                           inputs (string-append "xml/xsl/docbook-xsl-"
+                                                 #$(package-version docbook-xsl)
+                                                 "/xhtml/chunk.xsl")))))))))
+    (native-inputs (list autoconf
+                         automake
+                         libtool
+                         pkg-config
+                         python-cram
+                         python-wrapper
+                         which
+                         ;; For documentation
+                         libxml2        ;for XML_CATALOG_FILES
+                         libxslt
+                         docbook-xml-4.1.2
+                         docbook-xsl))
+    (inputs (list ck libaio luajit mysql postgresql))
+    (home-page "https://github.com/akopytov/sysbench/")
+    (synopsis "Scriptable database and system performance benchmark")
+    (description "@command{sysbench} is a scriptable multi-threaded benchmark
+tool based on LuaJIT.  It is most frequently used for database benchmarks, but
+can also be used to create arbitrarily complex workloads that do not involve a
+database server.  @command{sysbench} comes with the following bundled
+benchmarks:
+@table @file
+@item oltp_*.lua
+A collection of OLTP-like database benchmarks.
+@item fileio
+A filesystem-level benchmark.
+@item cpu
+A simple CPU benchmark.
+@item memory
+A memory access benchmark.
+@item threads
+A thread-based scheduler benchmark.
+@item mutex
+A POSIX mutex benchmark.
+@end table
+It includes features such as:
+@itemize
+@item
+Extensive statistics about rate and latency is available, including latency
+percentiles and histograms.
+@item
+Low overhead even with thousands of concurrent threads.  @command{sysbench} is
+capable of generating and tracking hundreds of millions of events per second.
+@item
+New benchmarks can be easily created by implementing pre-defined hooks in
+user-provided Lua scripts.
+@item
+@end itemize")
+    (license license:gpl2+)))
-- 
2.34.0





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

* [bug#54235] [PATCH v2 2/3] gnu: Add ck.
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 2/3] gnu: Add ck Maxim Cournoyer
@ 2022-03-08  9:39     ` Maxime Devos
  2022-03-08 14:36       ` Maxim Cournoyer
  2022-03-08  9:45     ` Maxime Devos
  2022-03-08  9:49     ` Maxime Devos
  2 siblings, 1 reply; 28+ messages in thread
From: Maxime Devos @ 2022-03-08  9:39 UTC (permalink / raw)
  To: Maxim Cournoyer, 54235

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

Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
> +              ;; TODO: Move AR-FOR-TARGET and LD-FOR-TARGET to (guix utils).
> +              (define* (ar-for-target #:optional (target #$(%current-target-system)))
> +                (if target
> +                    (string-append target "-ar")
> +                    "ar"))

I'm wondering, why not just do this now (in a separate patch)?
(guix utils) isn't (guix build utils), there are no rebuilding
concerns.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54235] [PATCH v2 3/3] gnu: Add sysbench.
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 3/3] gnu: Add sysbench Maxim Cournoyer
@ 2022-03-08  9:42     ` Maxime Devos
  2022-03-08 14:39       ` Maxim Cournoyer
  0 siblings, 1 reply; 28+ messages in thread
From: Maxime Devos @ 2022-03-08  9:42 UTC (permalink / raw)
  To: Maxim Cournoyer, 54235

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

Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
> +                           (search-input-file inputs
> +                                              "xml/dtd/docbook/catalog.xml")
> +                           "\n")))


docbook-xml-4.1.2 is in native-inputs, not inputs, so this needs to be
(search-input-file (or native-inputs inputs) ...) such that 'search-
input-file' succeeds even when compiling natively.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54235] [PATCH v2 2/3] gnu: Add ck.
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 2/3] gnu: Add ck Maxim Cournoyer
  2022-03-08  9:39     ` Maxime Devos
@ 2022-03-08  9:45     ` Maxime Devos
  2022-03-08 14:38       ` Maxim Cournoyer
  2022-03-08  9:49     ` Maxime Devos
  2 siblings, 1 reply; 28+ messages in thread
From: Maxime Devos @ 2022-03-08  9:45 UTC (permalink / raw)
  To: Maxim Cournoyer, 54235

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

Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
> +              (define (gnu-triplet->machine target)
> +                (letrec-syntax
> +                    ((matches (syntax-rules (=>)
> +                                ((_ (target-prefix => machine) rest ...)
> +                                 (if (string-prefix? target-prefix target)
> +                                     machine
> +                                     (matches rest ...)))
> +                                ((_)
> +                                 (error "unsupported target" target)))))
> +                  ;; This basically reproduces the logic handling the
> +                  ;; PLATFORM variable in the configure script.
> +                  (matches ("x86_64"      => "x86_64")
> +                           ("i586"        => "x86")
> +                           ("i686"        => "x86")
> +                           ("aarch64"     => "aarch64")
> +                           ("arm"         => "arm")
> +                           ("ppc64"       => "ppc64")
> +                           ("ppc"         => "ppc")
> +                           ("s390x"       => "s390x")
> +                           ("sparc64"     => "sparcv9"))))

I would move this outside the build code, such that new targets can be
added without having to rebuild ck and dependents.  Also, there are a
few 'target-foo?' procedures in (guix utils) that can be used here (if
it were moved outisde the build code).


Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54235] [PATCH v2 2/3] gnu: Add ck.
  2022-03-08  4:38   ` [bug#54235] [PATCH v2 2/3] gnu: Add ck Maxim Cournoyer
  2022-03-08  9:39     ` Maxime Devos
  2022-03-08  9:45     ` Maxime Devos
@ 2022-03-08  9:49     ` Maxime Devos
  2022-03-08 14:38       ` Maxim Cournoyer
  2 siblings, 1 reply; 28+ messages in thread
From: Maxime Devos @ 2022-03-08  9:49 UTC (permalink / raw)
  To: Maxim Cournoyer, 54235

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

Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
> +              ;; The custom configure script doesn't make cross-compilation
> +              ;; adjustments itself, so manually set the archiver, compiler
> +              ;; and linker.  Even then, it is still broken and doesn't
> +              ;; actually build any binary (see:
> +              ;; https://github.com/concurrencykit/ck/issues/191).

Since cross-compilation is currently broken, I think it would be
acceptable to not attempt it in Guix, though I would like a nice
comment and error instead of silently producing the wrong binaries:

  (when target
    ;; See <https://github.com/concurrencykit/ck/issues/191>
    ;; and <https://issues.guix.gnu.org/54235>.
    (error "ck is currently not cross-compilable"))

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* [bug#54235] [PATCH v3 1/4] gnu: docbook-xml-4.1.2: Install an XML catalog file.
  2022-03-03 13:53 [bug#54235] [PATCH 0/3] Add sysbench Maxim Cournoyer
  2022-03-03 14:05 ` [bug#54235] [PATCH 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2022-03-08  4:38 ` [bug#54235] [PATCH v2 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
@ 2022-03-08 14:36 ` Maxim Cournoyer
  2022-03-08 14:36   ` [bug#54235] [PATCH v3 2/4] utils: Add ar-for-target and ld-for-target procedures Maxim Cournoyer
                     ` (2 more replies)
  2 siblings, 3 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:36 UTC (permalink / raw)
  To: 54235; +Cc: maximedevos, Maxim Cournoyer

* gnu/packages/docbook.scm (docbook-xml-4.1.2)[builder]: Generate a catalog
file.
[native-inputs]: Add libxml2.
---
 gnu/packages/docbook.scm | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/docbook.scm b/gnu/packages/docbook.scm
index 6575bf2d75..0a8d2e2aed 100644
--- a/gnu/packages/docbook.scm
+++ b/gnu/packages/docbook.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
@@ -153,7 +153,8 @@ (define-public docbook-xml-4.2
                 "18hgwvmywh6a5jh38szjmg3hg2r4v5lb6r3ydc3rd8cp9wg61i5c"))))))
 
 (define-public docbook-xml-4.1.2
-  (package (inherit docbook-xml)
+  (package
+    (inherit docbook-xml)
     (version "4.1.2")
     (source (origin
               (method url-fetch)
@@ -167,13 +168,22 @@ (define-public docbook-xml-4.1.2
        #:builder
        (begin
          (use-modules (guix build utils))
-         (let ((source (assoc-ref %build-inputs "source"))
-               (unzip  (string-append (assoc-ref %build-inputs "unzip")
-                                      "/bin/unzip"))
-               (dtd    (string-append (assoc-ref %outputs "out")
-                                      "/xml/dtd/docbook")))
+         (let* ((source (assoc-ref %build-inputs "source"))
+                (unzip  (string-append (assoc-ref %build-inputs "unzip")
+                                       "/bin/unzip"))
+                (xmlcatalog  (string-append (assoc-ref %build-inputs "libxml2")
+                                            "/bin/xmlcatalog"))
+                (dtd    (string-append (assoc-ref %outputs "out")
+                                       "/xml/dtd/docbook"))
+                (catalog.xml (string-append dtd "/catalog.xml")))
            (mkdir-p dtd)
-           (invoke unzip source "-d" dtd)))))))
+           (invoke unzip source "-d" dtd)
+           ;; Create a minimal XML catalog, to use with libxml2 tools.
+           (invoke xmlcatalog "--noout" "--create" catalog.xml)
+           (invoke xmlcatalog "--noout" "--add" "public"
+                   "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   (string-append dtd "/docbookx.dtd") catalog.xml)))))
+    (native-inputs (list libxml2 unzip))))
 
 (define-public docbook-xsl
   (package
-- 
2.34.0





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

* [bug#54235] [PATCH v3 2/4] utils: Add ar-for-target and ld-for-target procedures.
  2022-03-08 14:36 ` [bug#54235] [PATCH v3 1/4] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
@ 2022-03-08 14:36   ` Maxim Cournoyer
  2022-03-08 14:36   ` [bug#54235] [PATCH v3 3/4] gnu: Add ck Maxim Cournoyer
  2022-03-08 14:36   ` [bug#54235] [PATCH v3 4/4] gnu: Add sysbench Maxim Cournoyer
  2 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:36 UTC (permalink / raw)
  To: 54235; +Cc: maximedevos, Maxim Cournoyer

* guix/utils.scm (ar-for-target, ld-for-target): New procedures.
---
 guix/utils.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/utils.scm b/guix/utils.scm
index a0ca9b9070..44c46cb4a9 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -99,8 +99,10 @@ (define-module (guix utils)
             target-powerpc?
             target-riscv64?
             target-64bit?
+            ar-for-target
             cc-for-target
             cxx-for-target
+            ld-for-target
             pkg-config-for-target
 
             version-compare
@@ -715,6 +717,11 @@ (define* (target-64bit? #:optional (system (or (%current-target-system)
   (any (cut string-prefix? <> system) '("x86_64" "aarch64" "mips64"
                                         "powerpc64" "riscv64")))
 
+(define* (ar-for-target #:optional (target (%current-target-system)))
+  (if target
+      (string-append target "-ar")
+      "ar"))
+
 (define* (cc-for-target #:optional (target (%current-target-system)))
   (if target
       (string-append target "-gcc")
@@ -725,6 +732,11 @@ (define* (cxx-for-target #:optional (target (%current-target-system)))
       (string-append target "-g++")
       "g++"))
 
+(define* (ld-for-target #:optional (target (%current-target-system)))
+  (if target
+      (string-append target "-ld")
+      "ld"))
+
 (define* (pkg-config-for-target #:optional (target (%current-target-system)))
   (if target
       (string-append target "-pkg-config")
-- 
2.34.0





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

* [bug#54235] [PATCH v3 3/4] gnu: Add ck.
  2022-03-08 14:36 ` [bug#54235] [PATCH v3 1/4] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2022-03-08 14:36   ` [bug#54235] [PATCH v3 2/4] utils: Add ar-for-target and ld-for-target procedures Maxim Cournoyer
@ 2022-03-08 14:36   ` Maxim Cournoyer
  2022-03-08 14:36   ` [bug#54235] [PATCH v3 4/4] gnu: Add sysbench Maxim Cournoyer
  2 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:36 UTC (permalink / raw)
  To: 54235; +Cc: maximedevos, Maxim Cournoyer

* gnu/packages/c.scm (ck): New variable.
---
 gnu/packages/c.scm | 78 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index e53a7c865f..d545d98938 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages c)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
+  #:use-module (guix store)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bootstrap)
@@ -896,6 +897,83 @@ (define-public aws-c-mqtt
     (home-page "https://github.com/awslabs/aws-c-mqtt")
     (license license:asl2.0)))
 
+;;; Factored out of the ck package so that it can be adjusted and called on
+;;; the host side easily, without impacting the package definition.
+(define (gnu-triplet->ck-machine target)
+  (letrec-syntax
+      ((matches (syntax-rules (=>)
+                  ((_ (target-prefix => machine) rest ...)
+                   (if (string-prefix? target-prefix target)
+                       machine
+                       (matches rest ...)))
+                  ((_)
+                   (error "unsupported target" target)))))
+    ;; This basically reproduces the logic handling the
+    ;; PLATFORM variable in the configure script of ck.
+    (matches ("x86_64"      => "x86_64")
+             ("i586"        => "x86")
+             ("i686"        => "x86")
+             ("aarch64"     => "aarch64")
+             ("arm"         => "arm")
+             ("ppc64"       => "ppc64")
+             ("ppc"         => "ppc")
+             ("s390x"       => "s390x")
+             ("sparc64"     => "sparcv9"))))
+
+(define-public ck
+  (package
+    (name "ck")
+    (version "0.7.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/concurrencykit/ck")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "020yzfpvymdc8lc44znlnxmxb8mvp42g4nb4p8k814klazqvwh0x"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'configure
+            ;; ck uses a custom configure script that stumbles on
+            ;; '--enable-fast-install', among other things.
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (define target-machine #$(and=> (%current-target-system)
+                                              gnu-triplet->ck-machine))
+              (when target-machine
+                ;; The configure script doesn't currently work for
+                ;; cross-compiling (see:
+                ;; https://github.com/concurrencykit/ck/issues/191).
+                (error "ck cannot currently be cross-compiled"))
+              ;; The custom configure script doesn't make cross-compilation
+              ;; adjustments itself, so manually set the archiver, compiler
+              ;; and linker.
+              (setenv "AR" #$(ar-for-target))
+              (setenv "CC" #$(cc-for-target))
+              (setenv "LD" #$(ld-for-target))
+              (apply invoke "./configure"
+                     `(,@(if target-machine
+                             (list (string-append "--profile=" target-machine))
+                             '())
+                       ,(string-append "--prefix=" #$output)
+                       ,(string-append "--mandir=" #$output "/share/man")
+                       ,(string-append "--cores="
+                                       (if parallel-build?
+                                           (number->string (parallel-job-count))
+                                           "1")))))))))
+    (home-page "https://github.com/concurrencykit/ck")
+    (synopsis "C library for concurrent systems")
+    (description "Concurrency Kit (@code{ck}) provides concurrency primitives,
+safe memory reclamation mechanisms and non-blocking (including lock-free) data
+structures designed to aid in the research, design and implementation of high
+performance concurrent systems developed in C99+.")
+    (license (list license:bsd-2        ;everything except...
+                   license:asl2.0))))   ;src/ck_hp.c
+
 (define-public utf8-h
   ;; The latest tag is used as there is no release.
   (let ((commit "500d4ea9f4c3449e5243c088d8af8700f7189734")
-- 
2.34.0





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

* [bug#54235] [PATCH v3 4/4] gnu: Add sysbench.
  2022-03-08 14:36 ` [bug#54235] [PATCH v3 1/4] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
  2022-03-08 14:36   ` [bug#54235] [PATCH v3 2/4] utils: Add ar-for-target and ld-for-target procedures Maxim Cournoyer
  2022-03-08 14:36   ` [bug#54235] [PATCH v3 3/4] gnu: Add ck Maxim Cournoyer
@ 2022-03-08 14:36   ` Maxim Cournoyer
  2 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:36 UTC (permalink / raw)
  To: 54235; +Cc: maximedevos, Maxim Cournoyer

* gnu/packages/benchmark.scm (sysbench): New variable.
---
 gnu/packages/benchmark.scm | 139 +++++++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)

diff --git a/gnu/packages/benchmark.scm b/gnu/packages/benchmark.scm
index eb5df3d4c3..0277c9e7b9 100644
--- a/gnu/packages/benchmark.scm
+++ b/gnu/packages/benchmark.scm
@@ -37,19 +37,27 @@ (define-module (gnu packages benchmark)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages c)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages kde-frameworks)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages docbook)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lua)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages opencl)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages xml)
   #:use-module (ice-9 match))
 
 (define-public fio
@@ -430,3 +438,134 @@ (define-public kdiskmark
 @item Report generation.
 @end itemize")
     (license license:gpl3+)))
+
+(define-public sysbench
+  (package
+    (name "sysbench")
+    (version "1.0.20")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/akopytov/sysbench")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; Ensure no bundled libraries get used.
+                          (delete-file-recursively "third_party")
+                          (substitute* "configure.ac"
+                            (("^third_party/.*")
+                             ""))
+                          (substitute* "Makefile.am"
+                            ((".*(LUAJIT|CK)_DIR =.*")
+                             ""))))
+              (sha256
+               (base32
+                "1sanvl2a52ff4shj62nw395zzgdgywplqvwip74ky8q7s6qjf5qy"))))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:configure-flags #~(list "--with-pgsql"
+                                ;; Explicitly specify the library directory of
+                                ;; MySQL, otherwise `mysql_config` gets
+                                ;; consulted and adds unnecessary link
+                                ;; directives.
+                                (string-append "--with-mysql-libs="
+                                               #$(this-package-input "mysql")
+                                               "/lib")
+                                "--with-system-luajit"
+                                "--with-system-ck"
+                                ;; If we let the build tool select the most
+                                ;; optimal compiler architecture flag, the
+                                ;; build is not reproducible.
+                                "--without-gcc-arch")
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-test-runner
+                     (lambda _
+                       (substitute* "tests/test_run.sh"
+                         (("/bin/bash")
+                          (which "bash"))
+                         ;; Do not attempt to invoke the cram command via
+                         ;; Python, as on Guix it is a shell script (wrapper).
+                         (("\\$\\(command -v cram\\)")
+                          "-m cram"))))
+                   (add-after 'unpack 'disable-test-installation
+                     (lambda _
+                       (substitute* "tests/Makefile.am"
+                         (("install-data-local")
+                          "do-not-install-data-local")
+                         (("^test_SCRIPTS.*")
+                          ""))))
+                   (add-after 'unpack 'fix-docbook
+                     (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                       (substitute* "m4/ax_check_docbook.m4"
+                         (("DOCBOOK_ROOT=.*" all)
+                          (string-append
+                           all "XML_CATALOG="
+                           (search-input-file (or native-inputs inputs)
+                                              "xml/dtd/docbook/catalog.xml")
+                           "\n")))
+                       (substitute* "doc/xsl/xhtml.xsl"
+                         (("http://docbook.sourceforge.net/release/xsl\
+/current/xhtml/docbook.xsl")
+                          (search-input-file
+                           (or native-inputs inputs)
+                           (string-append "xml/xsl/docbook-xsl-"
+                                          #$(package-version docbook-xsl)
+                                          "/xhtml/docbook.xsl"))))
+                       (substitute* "doc/xsl/xhtml-chunk.xsl"
+                         (("http://docbook.sourceforge.net/release/xsl\
+/current/xhtml/chunk.xsl")
+                          (search-input-file
+                           (or native-inputs inputs)
+                           (string-append "xml/xsl/docbook-xsl-"
+                                          #$(package-version docbook-xsl)
+                                          "/xhtml/chunk.xsl")))))))))
+    (native-inputs (list autoconf
+                         automake
+                         libtool
+                         pkg-config
+                         python-cram
+                         python-wrapper
+                         which
+                         ;; For documentation
+                         libxml2        ;for XML_CATALOG_FILES
+                         libxslt
+                         docbook-xml-4.1.2
+                         docbook-xsl))
+    (inputs (list ck libaio luajit mysql postgresql))
+    (home-page "https://github.com/akopytov/sysbench/")
+    (synopsis "Scriptable database and system performance benchmark")
+    (description "@command{sysbench} is a scriptable multi-threaded benchmark
+tool based on LuaJIT.  It is most frequently used for database benchmarks, but
+can also be used to create arbitrarily complex workloads that do not involve a
+database server.  @command{sysbench} comes with the following bundled
+benchmarks:
+@table @file
+@item oltp_*.lua
+A collection of OLTP-like database benchmarks.
+@item fileio
+A filesystem-level benchmark.
+@item cpu
+A simple CPU benchmark.
+@item memory
+A memory access benchmark.
+@item threads
+A thread-based scheduler benchmark.
+@item mutex
+A POSIX mutex benchmark.
+@end table
+It includes features such as:
+@itemize
+@item
+Extensive statistics about rate and latency is available, including latency
+percentiles and histograms.
+@item
+Low overhead even with thousands of concurrent threads.  @command{sysbench} is
+capable of generating and tracking hundreds of millions of events per second.
+@item
+New benchmarks can be easily created by implementing pre-defined hooks in
+user-provided Lua scripts.
+@item
+@end itemize")
+    (license license:gpl2+)))
-- 
2.34.0





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

* [bug#54235] [PATCH v2 2/3] gnu: Add ck.
  2022-03-08  9:39     ` Maxime Devos
@ 2022-03-08 14:36       ` Maxim Cournoyer
  0 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:36 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi Maxime,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
>> +              ;; TODO: Move AR-FOR-TARGET and LD-FOR-TARGET to (guix utils).
>> +              (define* (ar-for-target #:optional (target #$(%current-target-system)))
>> +                (if target
>> +                    (string-append target "-ar")
>> +                    "ar"))
>
> I'm wondering, why not just do this now (in a separate patch)?
> (guix utils) isn't (guix build utils), there are no rebuilding
> concerns.

Indeed.  Done in v3.

Thanks!

Maxim

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

* [bug#54235] [PATCH v2 2/3] gnu: Add ck.
  2022-03-08  9:45     ` Maxime Devos
@ 2022-03-08 14:38       ` Maxim Cournoyer
  0 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:38 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
>> +              (define (gnu-triplet->machine target)
>> +                (letrec-syntax
>> +                    ((matches (syntax-rules (=>)
>> +                                ((_ (target-prefix => machine) rest ...)
>> +                                 (if (string-prefix? target-prefix target)
>> +                                     machine
>> +                                     (matches rest ...)))
>> +                                ((_)
>> +                                 (error "unsupported target" target)))))
>> +                  ;; This basically reproduces the logic handling the
>> +                  ;; PLATFORM variable in the configure script.
>> +                  (matches ("x86_64"      => "x86_64")
>> +                           ("i586"        => "x86")
>> +                           ("i686"        => "x86")
>> +                           ("aarch64"     => "aarch64")
>> +                           ("arm"         => "arm")
>> +                           ("ppc64"       => "ppc64")
>> +                           ("ppc"         => "ppc")
>> +                           ("s390x"       => "s390x")
>> +                           ("sparc64"     => "sparcv9"))))
>
> I would move this outside the build code, such that new targets can be
> added without having to rebuild ck and dependents.

Done!

> Also, there are a few 'target-foo?' procedures in (guix utils) that can be used here (if
> it were moved outisde the build code).

I left the code as-is, as it seemed more uniform this way.

Thanks,

Maxim

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

* [bug#54235] [PATCH v2 2/3] gnu: Add ck.
  2022-03-08  9:49     ` Maxime Devos
@ 2022-03-08 14:38       ` Maxim Cournoyer
  0 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:38 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
>> +              ;; The custom configure script doesn't make cross-compilation
>> +              ;; adjustments itself, so manually set the archiver, compiler
>> +              ;; and linker.  Even then, it is still broken and doesn't
>> +              ;; actually build any binary (see:
>> +              ;; https://github.com/concurrencykit/ck/issues/191).
>
> Since cross-compilation is currently broken, I think it would be
> acceptable to not attempt it in Guix, though I would like a nice
> comment and error instead of silently producing the wrong binaries:
>
>   (when target
>     ;; See <https://github.com/concurrencykit/ck/issues/191>
>     ;; and <https://issues.guix.gnu.org/54235>.
>     (error "ck is currently not cross-compilable"))

I agree.  Done!

Maxim




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

* [bug#54235] [PATCH v2 3/3] gnu: Add sysbench.
  2022-03-08  9:42     ` Maxime Devos
@ 2022-03-08 14:39       ` Maxim Cournoyer
  2022-03-08 17:27         ` Maxime Devos
  0 siblings, 1 reply; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-08 14:39 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235

Hi,

Maxime Devos <maximedevos@telenet.be> writes:

> Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
>> +                           (search-input-file inputs
>> +                                              "xml/dtd/docbook/catalog.xml")
>> +                           "\n")))
>
>
> docbook-xml-4.1.2 is in native-inputs, not inputs, so this needs to be
> (search-input-file (or native-inputs inputs) ...) such that 'search-
> input-file' succeeds even when compiling natively.

Oops!  Good catch.  I'd be nice to have all this cross-compilation
gotchas and knowledge captured in a node under 'Contributing'; I keep
forgetting, and I'm sure I'm not alone :-).

Maxim

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

* [bug#54235] [PATCH v2 3/3] gnu: Add sysbench.
  2022-03-08 14:39       ` Maxim Cournoyer
@ 2022-03-08 17:27         ` Maxime Devos
  2022-03-18  5:38           ` bug#54235: [PATCH 0/3] " Maxim Cournoyer
  0 siblings, 1 reply; 28+ messages in thread
From: Maxime Devos @ 2022-03-08 17:27 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 54235

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

Maxim Cournoyer schreef op di 08-03-2022 om 09:39 [-0500]:
> > Maxim Cournoyer schreef op ma 07-03-2022 om 23:38 [-0500]:
> > > +                           (search-input-file inputs
> > > +                                             
> > > "xml/dtd/docbook/catalog.xml")
> > > +                           "\n")))
> > 
> > 
> > docbook-xml-4.1.2 is in native-inputs, not inputs, so this needs to
> > be
> > (search-input-file (or native-inputs inputs) ...) such that
> > 'search-
> > input-file' succeeds even when compiling natively.
> 
> Oops!  Good catch.  I'd be nice to have all this cross-compilation
> gotchas and knowledge captured in a node under 'Contributing'; I keep
> forgetting, and I'm sure I'm not alone :-).

FWIW, I've seen a few similar issues with docbook in the past (*)
and it should be feasible to write a linter for these kind of
inputs/native-inputs+docbook issues -- the 'wrapper-inputs' linter
(which checks that 'bash/bash-minimal' is in the inputs whenever
'wrap-program' is used) might be a good starting point.

This also seems like something (guix scripts style) could be taught to
automatically correct but I'm not familiar with that part of Guix.

(*) If I do 'git grep -F xml/dtd/docbook' and select a few cases, I see
quite a few suspicious uses ...

Greetings,
Maxime

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* bug#54235: [PATCH 0/3] Add sysbench.
  2022-03-08 17:27         ` Maxime Devos
@ 2022-03-18  5:38           ` Maxim Cournoyer
  0 siblings, 0 replies; 28+ messages in thread
From: Maxim Cournoyer @ 2022-03-18  5:38 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 54235-done

Hello!

As discussed some time ago on #guix, you were OK with this series with
in its last revision.

I've pushed the change to docbook-xml-4.1.2 to core-updates, and the
rest to master, after noting that it would build with 'docbook-xml' just
fine.

Thanks for the review!

Closing.

Maxim






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

end of thread, other threads:[~2022-03-18  5:41 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 13:53 [bug#54235] [PATCH 0/3] Add sysbench Maxim Cournoyer
2022-03-03 14:05 ` [bug#54235] [PATCH 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
2022-03-03 14:05   ` [bug#54235] [PATCH 2/3] gnu: Add ck Maxim Cournoyer
2022-03-03 16:55     ` Maxime Devos
2022-03-07 18:57       ` Maxim Cournoyer
2022-03-07 20:57         ` Maxime Devos
2022-03-08  1:47           ` Maxim Cournoyer
2022-03-08  4:06           ` Maxim Cournoyer
2022-03-03 14:05   ` [bug#54235] [PATCH 3/3] gnu: Add sysbench Maxim Cournoyer
2022-03-03 16:42     ` Maxime Devos
2022-03-07 18:59       ` Maxim Cournoyer
2022-03-08  4:38 ` [bug#54235] [PATCH v2 1/3] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
2022-03-08  4:38   ` [bug#54235] [PATCH v2 2/3] gnu: Add ck Maxim Cournoyer
2022-03-08  9:39     ` Maxime Devos
2022-03-08 14:36       ` Maxim Cournoyer
2022-03-08  9:45     ` Maxime Devos
2022-03-08 14:38       ` Maxim Cournoyer
2022-03-08  9:49     ` Maxime Devos
2022-03-08 14:38       ` Maxim Cournoyer
2022-03-08  4:38   ` [bug#54235] [PATCH v2 3/3] gnu: Add sysbench Maxim Cournoyer
2022-03-08  9:42     ` Maxime Devos
2022-03-08 14:39       ` Maxim Cournoyer
2022-03-08 17:27         ` Maxime Devos
2022-03-18  5:38           ` bug#54235: [PATCH 0/3] " Maxim Cournoyer
2022-03-08 14:36 ` [bug#54235] [PATCH v3 1/4] gnu: docbook-xml-4.1.2: Install an XML catalog file Maxim Cournoyer
2022-03-08 14:36   ` [bug#54235] [PATCH v3 2/4] utils: Add ar-for-target and ld-for-target procedures Maxim Cournoyer
2022-03-08 14:36   ` [bug#54235] [PATCH v3 3/4] gnu: Add ck Maxim Cournoyer
2022-03-08 14:36   ` [bug#54235] [PATCH v3 4/4] gnu: Add sysbench Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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