Message ID | 20220303140558.29261-2-maxim.cournoyer@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4A2C927BBEA; Thu, 3 Mar 2022 14:07:53 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0F84527BBE9 for <patchwork@mira.cbaines.net>; Thu, 3 Mar 2022 14:07:53 +0000 (GMT) Received: from localhost ([::1]:49616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1nPm7U-0006OU-8j for patchwork@mira.cbaines.net; Thu, 03 Mar 2022 09:07:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nPm6h-0005Jt-2h for guix-patches@gnu.org; Thu, 03 Mar 2022 09:07:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nPm6g-0003rF-QZ for guix-patches@gnu.org; Thu, 03 Mar 2022 09:07:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1nPm6g-0004qu-M8 for guix-patches@gnu.org; Thu, 03 Mar 2022 09:07:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54235] [PATCH 2/3] gnu: Add ck. Resent-From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Mar 2022 14:07:02 +0000 Resent-Message-ID: <handler.54235.B54235.164631637518572@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54235 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54235@debbugs.gnu.org Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com> Received: via spool by 54235-submit@debbugs.gnu.org id=B54235.164631637518572 (code B ref 54235); Thu, 03 Mar 2022 14:07:02 +0000 Received: (at 54235) by debbugs.gnu.org; 3 Mar 2022 14:06:15 +0000 Received: from localhost ([127.0.0.1]:41868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1nPm5v-0004pT-32 for submit@debbugs.gnu.org; Thu, 03 Mar 2022 09:06:15 -0500 Received: from mail-qv1-f48.google.com ([209.85.219.48]:43649) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <maxim.cournoyer@gmail.com>) id 1nPm5s-0004p4-QT for 54235@debbugs.gnu.org; Thu, 03 Mar 2022 09:06:13 -0500 Received: by mail-qv1-f48.google.com with SMTP id jv12so4139688qvb.10 for <54235@debbugs.gnu.org>; Thu, 03 Mar 2022 06:06:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RcoWdflpfGlnJR495EP0Ao5A2Dg5c2/LyQPLgkfe5YY=; b=NdZyyrZjXxG9lpfkgoBy2KHN4qgx6+ud4DKea+IG32QgR9HZuo7AxGoxOS9FOdEnP7 r32U231ouXXhkSxm2qcBAsG5ZdtymobXEyhHWXhGa/6LDu1BO4Dz9MC0xBi0RtWZr5il hi+DCt950v1/OgN7eyNXpcW9rv6xUNLevEyfwUaFNx1UuwqI4titVDDNicS2SfIQ7KXf o9pUAAwZcZjvNkRVbKU22I9m2c7jjV6lyYKwBVHvgGV1sFAkmwQLbSE2+vsQ6ZsjZwbO SC95vIu/GdHTGUqrua4EGj3giMEzorduVFfRlHRmNDFOO+YAiSS+KdEpajCGr3ex1PMp RjPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RcoWdflpfGlnJR495EP0Ao5A2Dg5c2/LyQPLgkfe5YY=; b=zp2aBdxGwgy6x48eeDH7jaf06+QUws1DCDxSKSj8qQ2zuwgRkY8USIRBXkuHeyA3Pi rh+Ap8yXFK2wqahSgnm9TojXlPn6vpAO3K9pfe5OAnXQoMPwgaEXp/MjHSzQt6i0OXbQ aowJf0gr6/qxwL5pAwzVY+7qRtDX9AaGCmuxf4kKSPOKj0UmZ1K+dfmq3/JwxwEgmCIu SgV8ku4/2fv5wdBjN+AOoQQrpkCH4aJfCdx8oGwJyraKpWxJs1CHc3ewoa4lRslPRjLV TtVv8wGSYVHlSWjYxbdeRVZ/Loa4yGq2K2hCFnpdI80Q0sN2Wt56i3LNW4CAdrjwveXq nzaQ== X-Gm-Message-State: AOAM530UO+uv/evqMenrOJK3f+Qe466FtYxyaI7PkPmwyFUivB232tay WYILtYIed/4Af2wtQKoD0uGtrzBzqFE= X-Google-Smtp-Source: ABdhPJyhc4mJjBDxokcohYn+50ZfxXssDEi4sh8i3sp+Z9r9QUVsJ6rkxMchsdBeoChPx5qAZSgkmA== X-Received: by 2002:a05:6214:5082:b0:432:d204:fddb with SMTP id kk2-20020a056214508200b00432d204fddbmr19872410qvb.63.1646316367022; Thu, 03 Mar 2022 06:06:07 -0800 (PST) Received: from localhost.localdomain (dsl-141-39.b2b2c.ca. [66.158.141.39]) by smtp.gmail.com with ESMTPSA id c16-20020a05622a059000b002dc93dc92d1sm1601272qtb.48.2022.03.03.06.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 06:06:06 -0800 (PST) From: Maxim Cournoyer <maxim.cournoyer@gmail.com> Date: Thu, 3 Mar 2022 09:05:57 -0500 Message-Id: <20220303140558.29261-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220303140558.29261-1-maxim.cournoyer@gmail.com> References: <20220303140558.29261-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series | Add sysbench. | |
Commit Message
Maxim Cournoyer
March 3, 2022, 2:05 p.m. UTC
* gnu/packages/c.scm (ck): New variable. --- gnu/packages/c.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
Comments
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.
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
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.
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
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
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")