[PATCH] build-system: go: Respect #:imported-modules when cross-compiling.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
Maxime Devos
Severity
normal
M
M
Maxime Devos wrote on 13 Sep 2022 13:01
(address . guix-patches@gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220913110105.10443-1-maximedevos@telenet.be
Previously, #:imported-modules was ignored, causing cross-compilation
failures. This bug seems seems to have been introduced in
e37dcf63dcea0817ffd74722ee5ff2d103aa2157.

After this commit, there remain other cross-compilation problems,
e.g. https://issues.guix.gnu.org/51981 fixes one of them.

* guix/build-system/go.scm (go-cross-build)[builder]: Wrapp in
with-imported-modules.
---
guix/build-system/go.scm | 67 ++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 33 deletions(-)

Toggle diff (98 lines)
diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 5e0e5bbad3..4b3b67b08f 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -240,45 +240,46 @@ (define* (go-cross-build name
(substitutable? #t))
"Cross-build NAME using GO, where TARGET is a GNU triplet and with INPUTS."
(define builder
- #~(begin
- (use-modules #$@(sexp->gexp modules))
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
- (define %build-host-inputs
- #+(input-tuples->gexp build-inputs))
+ (define %build-host-inputs
+ #+(input-tuples->gexp build-inputs))
- (define %build-target-inputs
- (append #$(input-tuples->gexp host-inputs)
+ (define %build-target-inputs
+ (append #$(input-tuples->gexp host-inputs)
#+(input-tuples->gexp target-inputs)))
- (define %build-inputs
- (append %build-host-inputs %build-target-inputs))
+ (define %build-inputs
+ (append %build-host-inputs %build-target-inputs))
- (define %outputs
- #$(outputs->gexp outputs))
+ (define %outputs
+ #$(outputs->gexp outputs))
- (go-build #:name #$name
- #:source #+source
- #:system #$system
- #:phases #$phases
- #:outputs %outputs
- #:target #$target
- #:goarch #$goarch
- #:goos #$goos
- #:inputs %build-target-inputs
- #:native-inputs %build-host-inputs
- #:search-paths '#$(map search-path-specification->sexp
- search-paths)
- #:native-search-paths '#$(map
- search-path-specification->sexp
- native-search-paths)
- #:install-source? #$install-source?
- #:import-path #$import-path
- #:unpack-path #$unpack-path
- #:build-flags #$build-flags
- #:tests? #$tests?
- #:make-dynamic-linker-cache? #f ;cross-compiling
- #:allow-go-reference? #$allow-go-reference?
- #:inputs %build-inputs)))
+ (go-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:phases #$phases
+ #:outputs %outputs
+ #:target #$target
+ #:goarch #$goarch
+ #:goos #$goos
+ #:inputs %build-target-inputs
+ #:native-inputs %build-host-inputs
+ #:search-paths '#$(map search-path-specification->sexp
+ search-paths)
+ #:native-search-paths '#$(map
+ search-path-specification->sexp
+ native-search-paths)
+ #:install-source? #$install-source?
+ #:import-path #$import-path
+ #:unpack-path #$unpack-path
+ #:build-flags #$build-flags
+ #:tests? #$tests?
+ #:make-dynamic-linker-cache? #f ;cross-compiling
+ #:allow-go-reference? #$allow-go-reference?
+ #:inputs %build-inputs))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))

base-commit: a44e08337d15b3f254a35d0311663c2bbd501852
prerequisite-patch-id: 0caac311875ee39cb48573657ebb960e90da6dfb
prerequisite-patch-id: 418285493d89ebf102175902d9b09a0174e88190
prerequisite-patch-id: 3c39eb839d9d3ff3fca6cd98621a5d5c411b7af4
prerequisite-patch-id: 8d5662e874c469f5ee496ef5181cf2d0a30ad1d8
prerequisite-patch-id: 26513c3b3b86963df718ee41d14a25d1cc6a8f3f
prerequisite-patch-id: 2b2497e2edec0afc48ebadd6f09f0c661c466127
prerequisite-patch-id: 2712efb97bf33985fd0658e4dd8e936dc08be5fe
prerequisite-patch-id: 9d2409b480a8bff0fef029b4b095922d4957e06f
prerequisite-patch-id: 51a32abca3efec1ba67ead59b8694c5ea3129ad3
prerequisite-patch-id: 7d55e3b39eb8803f058857d4412796b3f5dc0856
--
2.37.3
L
L
Ludovic Courtès wrote on 24 Sep 2022 16:17
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 57766-done@debbugs.gnu.org)
87h70w97re.fsf@gnu.org
Hi,

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (10 lines)
> Previously, #:imported-modules was ignored, causing cross-compilation
> failures. This bug seems seems to have been introduced in
> e37dcf63dcea0817ffd74722ee5ff2d103aa2157.
>
> After this commit, there remain other cross-compilation problems,
> e.g. <https://issues.guix.gnu.org/51981> fixes one of them.
>
> * guix/build-system/go.scm (go-cross-build)[builder]: Wrapp in
> with-imported-modules.

Good catch! Applied, thanks.

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 57766@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 57766
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