diff mbox series

[bug#51747] : gnu: nix: Update to 2.4.

Message ID 86pmoyrxyy.fsf@163.com
State New
Headers show
Series [bug#51747] : gnu: nix: Update to 2.4. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Zhu Zihao Jan. 11, 2022, 5:19 p.m. UTC
Patches updated.

Comments

Maxime Devos Jan. 11, 2022, 7:04 p.m. UTC | #1
Zhu Zihao schreef op wo 12-01-2022 om 01:19 [+0800]:
> +    (name "libcpuid") [...]
> +    (supported-systems '("x86_64-linux" "i686-linux"))

Given that 'cpuid' is a CPU instruction, I don't think
this is Linux-specific; presumably it works on the Hurd
as well.  According to the README, it also supports some BSDs,
Mac OS and Windows!

Could you change it to

(filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
        %supported-systems)

instead (untested)?

Also, the source code contains a blob
<https://github.com/anrieff/libcpuid/blob/master/libcpuid/msrdriver.c>,
could you remove it in an origin snippet?

There might be more blobs, I didn't look at all files.

Greetings,
Maxime.
Maxime Devos Jan. 11, 2022, 7:05 p.m. UTC | #2
Another two blobs:

<https://github.com/anrieff/libcpuid/blob/master/contrib/MSR Driver>
Zhu Zihao Jan. 12, 2022, 4:21 a.m. UTC | #3
Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
> Zhu Zihao schreef op wo 12-01-2022 om 01:19 [+0800]:
>> +    (name "libcpuid") [...]
>> +    (supported-systems '("x86_64-linux" "i686-linux"))
>
> Given that 'cpuid' is a CPU instruction, I don't think
> this is Linux-specific; presumably it works on the Hurd
> as well.  According to the README, it also supports some BSDs,
> Mac OS and Windows!
>
> Could you change it to
>
> (filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
>         %supported-systems)
>
> instead (untested)?
>
> Also, the source code contains a blob
> <https://github.com/anrieff/libcpuid/blob/master/libcpuid/msrdriver.c>,
> could you remove it in an origin snippet?
>
> There might be more blobs, I didn't look at all files.
>
> Greetings,
> Maxime.
>
> [[End of PGP Signed Part]]

Interesting, It looks that these blobs are for Windows system. I don't
care about MS Windows, but blobs are tightly integrated in the source.

The source reports that they're compiled from the source in contrib/MSR
Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
we have to use mingw cross compiler. This increase the complexity of
build script.

AFAIK, nix use libcpuid only in linux context. My idea is replace these
blobs with empty bytes. Maybe leave a note for who want mingw cross build.
Oleg Pykhalov Jan. 12, 2022, 5:19 a.m. UTC | #4
Zhu Zihao <all_but_last@163.com> writes:

[…]

> Interesting, It looks that these blobs are for Windows system. I don't
> care about MS Windows, but blobs are tightly integrated in the source.
>
> The source reports that they're compiled from the source in contrib/MSR
> Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
> we have to use mingw cross compiler. This increase the complexity of
> build script.
>
> AFAIK, nix use libcpuid only in linux context. My idea is replace these
> blobs with empty bytes. Maybe leave a note for who want mingw cross build. 

Does the current version 2.5.1 https://nixos.org/download.html contains
those blobs?

And in any case, could we update to 2.5.1 instead of 2.4?
Zhu Zihao Jan. 12, 2022, 7:08 a.m. UTC | #5
Oleg Pykhalov <go.wigust@gmail.com> writes:

> [[PGP Signed Part:Undecided]]
> Zhu Zihao <all_but_last@163.com> writes:
>
> […]
>
>> Interesting, It looks that these blobs are for Windows system. I don't
>> care about MS Windows, but blobs are tightly integrated in the source.
>>
>> The source reports that they're compiled from the source in contrib/MSR
>> Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
>> we have to use mingw cross compiler. This increase the complexity of
>> build script.
>>
>> AFAIK, nix use libcpuid only in linux context. My idea is replace these
>> blobs with empty bytes. Maybe leave a note for who want mingw cross build. 
>
> Does the current version 2.5.1 https://nixos.org/download.html contains
> those blobs?
>
> And in any case, could we update to 2.5.1 instead of 2.4?
>
> [[End of PGP Signed Part]]

Thank you for remind me the release of 2.5.1. We should update to 2.5.1

But the blob is contained in libcpuid, Nix 2.5.1 still use libcpuid for
x86 machine.
Maxime Devos Jan. 12, 2022, 8:26 a.m. UTC | #6
Zhu Zihao schreef op wo 12-01-2022 om 12:21 [+0800]:
> [
> ...]
> Interesting, It looks that these blobs are for Windows system. I don't
> care about MS Windows, but blobs are tightly integrated in the source.
> 
> The source reports that they're compiled from the source in contrib/MSR
> Driver/Kernel. They're PE COFF format, If we want to compile it ourself,
> we have to use mingw cross compiler. This increase the complexity of
> build script.
> 
> AFAIK, nix use libcpuid only in linux context. My idea is replace these
> blobs with empty bytes. Maybe leave a note for who want mingw cross build. 

Often (but not always, cf. rust), when software has files for specific
architectures or operating systems, they will only be compiled if they
match the architecture and operating system the software is compiled
for.  As such, there's a good chance the build will succeed (at least
for Linux, for Hurd, ...) if they are simply deleted.

Greetings,
Maxime.
Zhu Zihao Jan. 13, 2022, 4:54 a.m. UTC | #7
Maxime Devos <maximedevos@telenet.be> writes:

> Could you change it to
>
> (filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
>         %supported-systems)

I found that it actually only supports Linux & Windows. There're only
code stubs for other platform.

I've created a patch to libcpuid, make it only link with msrdriver.c
on Windows platform. See https://github.com/anrieff/libcpuid/pull/159.
Zhu Zihao Jan. 13, 2022, 7:54 a.m. UTC | #8
Zhu Zihao <all_but_last@163.com> writes:

> I found that it actually only supports Linux & Windows. There're only
> code stubs for other platform.

Correction, the MSR detection is limited to Linux & Windows, while other
functionalities are not.
Maxime Devos Jan. 14, 2022, 1:06 p.m. UTC | #9
Zhu Zihao schreef op do 13-01-2022 om 12:54 [+0800]:
> Maxime Devos <maximedevos@telenet.be> writes:
> 
> > Could you change it to
> > 
> > (filter (lambda (t) (or (x86-64-target? t) (or (x86-32-target? t))))
> >         %supported-systems)
> 
> I found that it actually only supports Linux & Windows. There're only
> code stubs for other platform.

I doubt this, since libcpuid.h mentions FreeBSD and Solaris support,
and 'libcpuid/asm-bits.c' uses 'cpuid' whether it is Linux or Windows
or not.

Possibly there's more information available for Linux and Windows
than for the hurd (see e.g. 'libcpuid/rdmsr.c'), but it would seem that
_some_ usable information is available elsewhere.

Also, 'libcpuid/rdmsr.c' uses 'modprobe', does this need to be
absolutised?

Greetings,
Maxime.
diff mbox series

Patch

From e442322866f6edd625ada09573afb7bff51f269e Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 12 Jan 2022 00:42:32 +0800
Subject: [PATCH 5/5] gnu: nix: Use G-expression.

* gnu/packages/package-management.scm (nix)[arguments]: Convert to G-expression.
---
 gnu/packages/package-management.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 03f741dc2c..594d6e9d4b 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -676,19 +676,19 @@  (define-public nix
         (search-patches "nix-dont-build-html-doc.diff"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags '("--sysconfdir=/etc" "--enable-gc")
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'install
-           ;; Don't try & fail to create subdirectories in /etc, but keep them
-           ;; in the output as examples.
-           (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (etc (string-append out "/etc")))
-               (apply invoke "make" "install"
-                      (string-append "sysconfdir=" etc)
-                      (string-append "profiledir=" etc "/profile.d")
-                      make-flags)))))))
+     (list
+      #:configure-flags #~(list "--sysconfdir=/etc" "--enable-gc")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'install
+            ;; Don't try & fail to create subdirectories in /etc, but keep them
+            ;; in the output as examples.
+            (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+              (let ((etc (string-append #$output "/etc")))
+                (apply invoke "make" "install"
+                       (string-append "sysconfdir=" etc)
+                       (string-append "profiledir=" etc "/profile.d")
+                       make-flags)))))))
     (native-inputs
      (list autoconf
            autoconf-archive
-- 
2.34.0