[PATCH] gnu: dmraid: Fix cross-compiling to riscv64-linux.

  • Open
  • quality assurance status badge
Details
2 participants
  • Christopher Baines
  • Zheng Junjie
Owner
unassigned
Submitted by
Zheng Junjie
Severity
normal

Debbugs page

Z
Z
Zheng Junjie wrote on 22 Mar 09:44 -0700
(address . guix-patches@gnu.org)
a1e35066bfa43894fe6ab607cdc258866ed8896d.1711125878.git.zhengjunjie@iscas.ac.cn
* gnu/packages/disk.scm (dmraid)
[native-inputs]: When cross compiling to riscv64-linux-gnu, add config.
[arguments]: When target riscv64-linux-gnu, add update-config phase.

Change-Id: I491c43a6ce2c3fc3aed43ecab9d4a2ab251038bb
---
gnu/packages/disk.scm | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)

Toggle diff (51 lines)
diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm
index b0117d77ce..5339f54d99 100644
--- a/gnu/packages/disk.scm
+++ b/gnu/packages/disk.scm
@@ -27,7 +27,7 @@
;;; Copyright © 2022 Disseminate Dissent <disseminatedissent@protonmail.com>
;;; Copyright © 2023 Timotej Lazar <timotej.lazar@araneo.si>
;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com>
-;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1145,7 +1145,12 @@ (define-public dmraid
"1n7vsqvh7y6yvil682q129d21yhb0cmvd5fvsbkza7ypd78inhlk"))))
(build-system gnu-build-system)
(inputs (list lvm2))
- (native-inputs (list which))
+ (native-inputs
+ (append (if (and (target-riscv64?)
+ (%current-target-system))
+ (list config)
+ '())
+ (list which)))
(arguments
`(#:tests? #f ; No tests.
;; Prevent a race condition where some target would attempt to link
@@ -1158,7 +1163,18 @@ (define-public dmraid
(chdir (string-append ,version "/dmraid"))
(substitute* "make.tmpl.in"
(("/bin/sh") (which "sh")))
- #t)))
+ #t))
+ ,@(if (and (target-riscv64?)
+ (%current-target-system))
+ `((add-after 'unpack 'update-config
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (for-each (lambda (file)
+ (install-file
+ (search-input-file
+ (or native-inputs inputs)
+ (string-append "/bin/" file)) "."))
+ '("config.guess" "config.sub")))))
+ '()))
#:configure-flags (list ;; Make sure programs such as 'dmevent_tool' can
;; find libdmraid.so.
(string-append "LDFLAGS=-Wl,-rpath="

base-commit: 40f53e8fb5b867e3a1e8fa798328423718282aac
--
2.41.0
C
C
Christopher Baines wrote on 27 Mar 05:44 -0700
(name . Zheng Junjie)(address . zhengjunjie@iscas.ac.cn)
875xx7hmhm.fsf@cbaines.net
Zheng Junjie <zhengjunjie@iscas.ac.cn> writes:

Toggle quote (9 lines)
> * gnu/packages/disk.scm (dmraid)
> [native-inputs]: When cross compiling to riscv64-linux-gnu, add config.
> [arguments]: When target riscv64-linux-gnu, add update-config phase.
>
> Change-Id: I491c43a6ce2c3fc3aed43ecab9d4a2ab251038bb
> ---
> gnu/packages/disk.scm | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)

Hi!

Thanks for the patch, this doesn't build for me though:

checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `riscv64-linux-gnu': machine `riscv64' not recognized
configure: error: /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash autoconf/config.sub riscv64-linux-gnu failed
error: in phase 'configure': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" arguments: ("./configure" "CC_FOR_BUILD=gcc" "CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" "SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash" "--prefix=/gnu/store/gb6ij94hk33ivx193zq87m2vhlhzsm8j-dmraid-1.0.0.rc16-3" "--enable-fast-install" "--build=x86_64-unknown-linux-gnu" "--host=riscv64-linux-gnu" "LDFLAGS=-Wl,-rpath=/gnu/store/gb6ij94hk33ivx193zq87m2vhlhzsm8j-dmraid-1.0.0.rc16-3/lib") exit-status: 1 term-signal: #f stop-signal: #f>


-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmYEFOVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xd7XBAAgpeU+HZ53CmpBrW/VTi+QWMG1wAz7y7e
l/QNu0Eqq3Guj4FtiPrwceaH2ulAhHYfnM414zcZUiZ2ZFmPVq4fK0PTH3T4NhRr
qFUREoml5cDrym9nW1VrQBgWQ4mcIpyNN+a+Hx3ceSIrEOYAVAMgfkj1ZTmKHtQY
2Zk0X1AiZZ4bnlQtVAgOE5bpQN1sBEgFLxSI++Uu2HJa+3SpHkXDBBTmuwZvPlQ1
2P8PipgaJ7i+iVfyAsbeQU16DENLC9CUkt50w+d7yILAJeZRUldjHZPeK6Yc4pEr
7xbrIsrTTXvFMhFmU+wNBfFPwbp3namoporB/efMyg+/JiIjhhlL3ck8m2deNcsy
AKAdzCNSRG+65/UYyDAMwWczdlUPIP2Uzp5zwTur77HPvJsbigwsy/A1GydAM8Se
xzGQHIqMOAOVgMSKLsCRbrK10jJqWiGqn098QYuFX8NLNp2/AlkromVPg7GGi8M7
+9mu1DXZ0I8kZG2OVh5J8pnCJ++kDJ+JJVyKZ2gq/uVsnb7i0nx5iAMRbxVYOCK8
zLH1jpycL8Jl2cQWzRtLEW1YMzz3pnjwcSUJbk6TivFE8x8AnUtIbAPHC0+rL3Ke
dXNWIzOQAuOOh7i4j2eXvDUdjBbHMXc/4PuLTn484dhT0LiXRaFqkkAB+HN8Ob92
3IFlte4z6Rs=
=YSmq
-----END PGP SIGNATURE-----

Z
Z
Zheng Junjie wrote on 27 Mar 06:40 -0700
(name . Christopher Baines)(address . mail@cbaines.net)(address . 69944@debbugs.gnu.org)
87a5mjg57z.fsf@iscas.ac.cn
Christopher Baines <mail@cbaines.net> writes:

Toggle quote (17 lines)
> [[PGP Signed Part:Undecided]]
>
> Zheng Junjie <zhengjunjie@iscas.ac.cn> writes:
>
>> * gnu/packages/disk.scm (dmraid)
>> [native-inputs]: When cross compiling to riscv64-linux-gnu, add config.
>> [arguments]: When target riscv64-linux-gnu, add update-config phase.
>>
>> Change-Id: I491c43a6ce2c3fc3aed43ecab9d4a2ab251038bb
>> ---
>> gnu/packages/disk.scm | 22 +++++++++++++++++++---
>> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> Hi!
>
> Thanks for the patch, this doesn't build for me though:

Sorry, this patch should build, and also build to aarch64-linux-gnu.
From 61f56da975095071649e48a6e975ffcdd4dd8063 Mon Sep 17 00:00:00 2001
Message-ID: <61f56da975095071649e48a6e975ffcdd4dd8063.1711546964.git.zhengjunjie@iscas.ac.cn>
From: Zheng Junjie <zhengjunjie@iscas.ac.cn>
Date: Sat, 23 Mar 2024 00:17:47 +0800
Subject: [PATCH] gnu: dmraid: Fix cross-compiling

* gnu/packages/disk.scm (dmraid)
[native-inputs]: When cross compiling, add config, autoconf, automake.
[arguments]: When cross compiling, add update-config and fix-rpl_malloc phase.

Change-Id: I491c43a6ce2c3fc3aed43ecab9d4a2ab251038bb
---
gnu/packages/disk.scm | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)

Toggle diff (68 lines)
diff --git a/gnu/packages/disk.scm b/gnu/packages/disk.scm
index b0117d77ce..35e75d89fe 100644
--- a/gnu/packages/disk.scm
+++ b/gnu/packages/disk.scm
@@ -27,7 +27,7 @@
;;; Copyright © 2022 Disseminate Dissent <disseminatedissent@protonmail.com>
;;; Copyright © 2023 Timotej Lazar <timotej.lazar@araneo.si>
;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com>
-;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1145,7 +1145,13 @@ (define-public dmraid
"1n7vsqvh7y6yvil682q129d21yhb0cmvd5fvsbkza7ypd78inhlk"))))
(build-system gnu-build-system)
(inputs (list lvm2))
- (native-inputs (list which))
+ (native-inputs
+ (append (if (%current-target-system)
+ (list config
+ autoconf
+ automake)
+ '())
+ (list which)))
(arguments
`(#:tests? #f ; No tests.
;; Prevent a race condition where some target would attempt to link
@@ -1158,7 +1164,34 @@ (define-public dmraid
(chdir (string-append ,version "/dmraid"))
(substitute* "make.tmpl.in"
(("/bin/sh") (which "sh")))
- #t)))
+ #t))
+ ,@(if (%current-target-system)
+ `((add-after 'unpack 'update-config
+ (lambda* (#:key native-inputs inputs
+ #:allow-other-keys)
+ (with-directory-excursion
+ (string-append ,version "/dmraid/autoconf")
+ (for-each (lambda (file)
+ (install-file
+ (search-input-file
+ (or native-inputs inputs)
+ (string-append "/bin/" file))
+ "."))
+ '("config.guess" "config.sub")))))
+ (add-after 'unpack 'fix-rpl_malloc
+ (lambda _
+ ;; AC_FUNC_MALLOC and AC_FUNC_REALLOC usually
+ ;; unneeded, see
+ ;; https://lists.gnu.org/archive/html/autoconf/2003-02/msg00017.html
+ (with-directory-excursion
+ (string-append ,version "/dmraid")
+ (substitute* "configure.in"
+ (("AC_FUNC_MALLOC") "")
+ (("AC_FUNC_REALLOC") ""))
+ (delete-file "./configure")
+ (copy-file "configure.in" "configure.ac")
+ (invoke "autoreconf" "-fiv")))))
+ '()))
#:configure-flags (list ;; Make sure programs such as 'dmevent_tool' can
;; find libdmraid.so.
(string-append "LDFLAGS=-Wl,-rpath="

base-commit: 656baadf83f2812c0ff79f4f2f0b5f1e927ed8a5
--
2.41.0
Toggle quote (23 lines)
>
> checking build system type... x86_64-unknown-linux-gnu
> checking host system type... Invalid configuration
> `riscv64-linux-gnu': machine `riscv64' not recognized
> configure: error:
> /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash
> autoconf/config.sub riscv64-linux-gnu failed
> error: in phase 'configure': uncaught exception:
> %exception #<&invoke-error program:
> "/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash"
> arguments: ("./configure" "CC_FOR_BUILD=gcc"
> "CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash"
> "SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash"
> "--prefix=/gnu/store/gb6ij94hk33ivx193zq87m2vhlhzsm8j-dmraid-1.0.0.rc16-3"
> "--enable-fast-install" "--build=x86_64-unknown-linux-gnu"
> "--host=riscv64-linux-gnu"
> "LDFLAGS=-Wl,-rpath=/gnu/store/gb6ij94hk33ivx193zq87m2vhlhzsm8j-dmraid-1.0.0.rc16-3/lib")
> exit-status: 1 term-signal: #f stop-signal: #f>
>
>
> https://bordeaux.guix.gnu.org/build/47b7e0bf-b082-4d62-ac4c-8de5c28f5faf/log
>
> [[End of PGP Signed Part]]
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmYEIpAACgkQO1qpk+Gi
3/DK2hAApHj53TD81WpDK/Otbkx9lUSoOf1rKh2B4bv1Ji0xNpz5qnVaihb8Nj3s
T9M74dxjAFA0WA/9+p6N/JaxykhNaVwNBLZeX18GbVJtG0huaGlIBZf3RDkNhCLf
1xf3YBdYaBr8jVpeWfk9KD7I0h3nO6IgGfj6mvde497q1d/qYzkx9+nGXu5kdlux
liwSk4CpYNbJQhBVuv5cJBCrd9uBtSbSV0ZIK8sOyrShdD/BtpGltTH4ItpQmXoE
E5nsW9ucECFdeLirAW4CXSmEPafxaPBRszq5FD9vvPqNielp5uTcC4nHCorTtIr3
rASgsCYIg5GN+WUKx3pcP80yXq+NON+zQnF7OcZNPyXCMWHXbhlouzlzl0LSrcMB
rnSig/YlKiQ6zt6FfduLO/JNWnLqiDQiurRCWKCo1zoS693WlqrHT9xP6msg344F
DqENkDsVrNvkqBaTI9+Rd8OVwd3rWGl9k6AzJApZ9CCAvqNAzRJ3Mca/Z2ISM94r
DLVKvsFaHYUjv47nVHQKpAqeg8NKwtG/qGTCEcfN1J9e3YSMGfQgLhRkw1I39hWQ
L94imUHVb23kdjXPpTGtyvLOWGJMBqw91mGJF4g5Y9aVI1wfTZ7r+SeAPNA/SqTT
X7/t2bl1+oGiWFWn1KFk9jAjxy3IHED7Wvaf9HzOYhvUvKDQCBI=
=TZUc
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 21 Apr 07:03 -0700
(name . Zheng Junjie)(address . zhengjunjie@iscas.ac.cn)(address . 69944@debbugs.gnu.org)
87zftm24p3.fsf@cbaines.net
Zheng Junjie <zhengjunjie@iscas.ac.cn> writes:

Toggle quote (21 lines)
> Christopher Baines <mail@cbaines.net> writes:
>
>> [[PGP Signed Part:Undecided]]
>>
>> Zheng Junjie <zhengjunjie@iscas.ac.cn> writes:
>>
>>> * gnu/packages/disk.scm (dmraid)
>>> [native-inputs]: When cross compiling to riscv64-linux-gnu, add config.
>>> [arguments]: When target riscv64-linux-gnu, add update-config phase.
>>>
>>> Change-Id: I491c43a6ce2c3fc3aed43ecab9d4a2ab251038bb
>>> ---
>>> gnu/packages/disk.scm | 22 +++++++++++++++++++---
>>> 1 file changed, 19 insertions(+), 3 deletions(-)
>>
>> Hi!
>>
>> Thanks for the patch, this doesn't build for me though:
>
> Sorry, this patch should build, and also build to aarch64-linux-gnu.

Thanks, would you be able to rebase this on master and resend, as I
don't think it applies currently?

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmYlHLhfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xce5hAAmeZrj5nGvjLOV/xReGaNQFFwSV8xWB7v
RVUWXnagpQLDBuevg8s2Jc8vMuOSUyADWGQYcBfjRLsQJh5hh2liwzfgX8x1bvOV
SfiCCIymH+NTspO2geSn9lTUStQZr9WIvQTMJ+flvUzDb/ZcPe4twsIzqVdH433p
lrBGFQV/6v7OX5xb3vUpqupKbTLCD5GLXcqKu9p0ZM0jnvTUGK6kDlRc6WYijc1b
zQl8rdlcK2H3qq4RIxjD6LKKMzTDa9EdSOH5XAwq4aBpTbaphBJ+6R99Gf5KIixB
U7qNUVca63OKadgxO7P/MSVIW12CiIyfQwWEbl5YQte6ByKGtY2cYuj0CmiBuLkA
X1hzCtKi37rwe2aueG5PVodw3Qvg92ImxlBKHmlWB11w7b162HWoUyvrJxFEdEXG
Kr0rtnJwoUktlYqn+8cGWjXmSqNF4cyfmSG+uyI5XRIdcCWLRcCYny7q0aG1A98T
dmcHaU3N6QMGZ4xjMteSBei1ErOy2sTAYnOghC7s4Uj576QMiLsx4Kc0wLPaXj/m
zM/SS+S6+8gQNqNNPot+CAUFkebX5XIjUHr1IGa6X8qSNFYTMw3C2/I8KK0dfzOX
5G0X9PTpv5TKAYrxGCvn7m97A9bFEcFUKxXseZTwXXVg86p1F3fxOGLVKSP6X5qP
yjQRbOEXuFA=
=aTzT
-----END PGP SIGNATURE-----

?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 69944@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 69944
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch