unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fixing xen build
@ 2022-03-20 18:12 Skyler via Development of GNU Guix and the GNU System distribution.
  2022-03-24 21:50 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Skyler via Development of GNU Guix and the GNU System distribution. @ 2022-03-20 18:12 UTC (permalink / raw)
  To: guix-devel@gnu.org


[-- Attachment #1.1.1: Type: text/plain, Size: 2746 bytes --]

Xen currently does not build on x86_64-linux (http://ci.guix.gnu.org/search?query=xen+system:x86_64-linux). It will build if all instances of .note.gnu.build-id are quoted in xen/arch/x86/xen.lds.S. This is because of the hyphen in the symbol in the argument to ADDR. I tested this by placing the following into a file named xen.scm and running guix build -f xen.scm:

```(use-modules (gnu)             (guix build utils)             (guix packages)             (srfi srfi-1))(use-package-modules virtualization)

(define (transform-keyword-value search-key transformer input output)  (let ((next-key (first input))        (next-value (second input))        (remaining (drop input 2)))    (if (eq? search-key next-key)        (append (list search-key (transformer next-value)) remaining output)        (transform-keyword-value search-key transformer remaining (cons* next-key next-value output)))))

(define (add-quotation-phase original-phases)  `(modify-phases ,original-phases    (add-before 'patch 'quotation-phase      (lambda (arg . args)        (format #t "PWD: ~A~%" (getcwd))        (substitute* "xen/arch/x86/xen.lds.S"          ((".note.gnu.build-id")           "\".note.gnu.build-id\""))))))

(package  (inherit xen)  (arguments (transform-keyword-value #:phases add-quotation-phase (package-arguments xen) '())))```

This produces the output path gnu/store/jzv2s5d01g7cz136xjcc9d27sdkjpdjd-xen-4.14.1 on this system:

```$ guix describeGeneration 6 Feb 25 2022 08:10:38 (current)  guix ed8d236    repository URL: https://git.savannah.gnu.org/git/guix.git    branch: master    commit: ed8d236eb938bc123a9ca8a079fea95edf7df6cd```

I'm not sure if this should be reported elsewhere. It might be that it's intended that symbols with hyphens need to be quoted when used in numeric expressions (which would make sense, it could be confused with subtraction) in which case Xen's script needs to be updated. It might be that ld is supposed to be able to understand that it's part of the symbol, in which case there's a bug in ld. But neither makes sense to me. Xen's package definition (including the source form) has not changed since the successful builds in December, so it worked before. Quoting the symbol seems reasonable based on how other languages behave, but .note.gnu.build-id seems like a standard practice based on some searches, and it's mentioned in ld's man page, so I would expect it to work easily. If the hyphen was going to cause issues, would the standard practice not use an underscore? I don't understand enough to know where else this should be reported, but the above code fixes the guix build which is what I care about most.

[-- Attachment #1.1.2.1: Type: text/html, Size: 6281 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

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

* Re: Fixing xen build
  2022-03-20 18:12 Fixing xen build Skyler via Development of GNU Guix and the GNU System distribution.
@ 2022-03-24 21:50 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2022-03-24 21:50 UTC (permalink / raw)
  To: Skyler via Development of GNU Guix and the GNU System distribution.
  Cc: Skyler

Hi Skyler,

Skyler via "Development of GNU Guix and the GNU System distribution."
<guix-devel@gnu.org> skribis:

> Xen currently does not build on x86_64-linux (http://ci.guix.gnu.org/search?query=xen+system:x86_64-linux). It will build if all instances of .note.gnu.build-id are quoted in
> xen/arch/x86/xen.lds.S. This is because of the hyphen in the symbol in the argument to ADDR. I tested this by placing the following into a file named xen.scm and running guix build -f
> xen.scm:

I added this to the ‘patch’ phase of ‘xen’ and can confirm that it
solves the problem (will push shortly).

> (define (transform-keyword-value search-key transformer input output)
>   (let ((next-key (first input))
>         (next-value (second input))
>         (remaining (drop input 2)))
>     (if (eq? search-key next-key)
>         (append (list search-key (transformer next-value)) remaining output)
>         (transform-keyword-value search-key transformer remaining (cons* next-key next-value output)))))

You can use ‘substitute-keyword-arguments’ from (guix utils) to do
that (unfortunately undocumented right now).

> I'm not sure if this should be reported elsewhere. It might be that it's intended that symbols with hyphens need to be quoted when used in numeric expressions (which would make sense, it
> could be confused with subtraction) in which case Xen's script needs to be updated. It might be that ld is supposed to be able to understand that it's part of the symbol, in which case
> there's a bug in ld. But neither makes sense to me. Xen's package definition (including the source form) has not changed since the successful builds in December, so it worked before. Quoting
> the symbol seems reasonable based on how other languages behave, but .note.gnu.build-id seems like a standard practice based on some searches, and it's mentioned in ld's man page, so I would
> expect it to work easily. If the hyphen was going to cause issues, would the standard practice not use an underscore? I don't understand enough to know where else this should be reported,
> but the above code fixes the guix build which is what I care about most.

I’m not sure exactly where the problem is, but I’m glad you found a
fix.  :-)

Hopefully we can eventually get rid of this hack.

Thanks!

Ludo’.


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

end of thread, other threads:[~2022-03-24 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-20 18:12 Fixing xen build Skyler via Development of GNU Guix and the GNU System distribution.
2022-03-24 21:50 ` Ludovic Courtès

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