GNU bug report logs - #37870
[PATCH] gnu: make-nsis: Fix cross-compilation.

Previous Next

Package: guix-patches;

Reported by: Carl Dong <contact <at> carldong.me>

Date: Tue, 22 Oct 2019 16:15:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37870 in the body.
You can then email your comments to 37870 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Tue, 22 Oct 2019 16:15:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Carl Dong <contact <at> carldong.me>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 22 Oct 2019 16:15:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Carl Dong <contact <at> carldong.me>
To: "guix-patches <at> gnu.org" <guix-patches <at> gnu.org>
Subject: [PATCH] gnu: make-nsis: Fix cross-compilation.
Date: Tue, 22 Oct 2019 16:14:33 +0000
Hi all, here's the somewhat hacky patch from #37801, I will follow up on #30756
about using `-idirafter` as a potentially cleaner fix for #30756, but this
should make nsis work for now!

* gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
ordering of search paths (mingw-w64 last).
---
 gnu/packages/installers.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index c987254d61..e5e38af152 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -92,7 +92,21 @@
                              ;; CROSS_-prefixed version of env vars
                              (setenv (string-append "CROSS_" env-name)
                                      (filter-delimited-string env-val mingw-path?))))
-                         '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
+                         '("CPATH" "LIBRARY_PATH"))
+                        ;; Hack to place mingw-w64 path at the end of search
+                        ;; paths.  Could probably use a specfile and dirafter
+                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                                (string-append
+                                 (string-join
+                                  (map (lambda (x) (string-append (assoc-ref %build-inputs "xgcc") x))
+                                       `("/include/c++"
+                                         ,(string-append "/include/c++/" ,triplet)
+                                         "/include/c++/backward"
+                                         "/lib/gcc/x86_64-w64-mingw32/7.4.0/include"
+                                         "/lib/gcc/x86_64-w64-mingw32/7.4.0/include-fixed"))
+                                  ":")
+                                 ":"
+                                 (getenv "CROSS_CPATH")))))
                     (add-before 'build 'fix-target-detection
                       (lambda _
                         ;; NSIS target detection is screwed up, manually
--
2.23.0






Information forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Tue, 29 Oct 2019 16:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 37870 <at> debbugs.gnu.org (full text, mbox):

From: Carl Dong <contact <at> carldong.me>
To: "37870 <at> debbugs.gnu.org" <37870 <at> debbugs.gnu.org>
Subject: [PATCH v2] gnu: make-nsis: Fix cross-compilation.
Date: Tue, 29 Oct 2019 16:02:01 +0000
Updated the patch to make it look a little better :-)
Will push to master tomorrow if no objections.

-----

* gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
ordering of search paths (mingw-w64 last).
---
 gnu/packages/installers.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index c987254d61..035d38ac5a 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -48,6 +48,7 @@
       (arguments
        `(#:scons ,scons-python2
          #:modules ((srfi srfi-1)
+                    (srfi srfi-26)
                     (guix build utils)
                     (guix build scons-build-system))
          #:tests? #f
@@ -92,7 +93,19 @@
                              ;; CROSS_-prefixed version of env vars
                              (setenv (string-append "CROSS_" env-name)
                                      (filter-delimited-string env-val mingw-path?))))
-                         '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
+                         '("CPATH" "LIBRARY_PATH"))
+                        ;; Hack to place mingw-w64 path at the end of search
+                        ;; paths.  Could probably use a specfile and dirafter
+                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                                (string-join
+                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
+                                          `("/include/c++"
+                                            ,(string-append "/include/c++/" ,triplet)
+                                            "/include/c++/backward"
+                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include"
+                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include-fixed"))
+                                   ,(getenv "CROSS_CPATH"))
+                                 ":"))))
                     (add-before 'build 'fix-target-detection
                       (lambda _
                         ;; NSIS target detection is screwed up, manually
--
2.23.0




Information forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Tue, 29 Oct 2019 19:23:01 GMT) Full text and rfc822 format available.

Message #11 received at 37870 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Carl Dong <contact <at> carldong.me>
Cc: "37870 <at> debbugs.gnu.org" <37870 <at> debbugs.gnu.org>
Subject: Re: [bug#37870] [PATCH v2] gnu: make-nsis: Fix cross-compilation.
Date: Tue, 29 Oct 2019 21:22:14 +0200
[Message part 1 (text/plain, inline)]
On Tue, Oct 29, 2019 at 04:02:01PM +0000, Carl Dong wrote:
> Updated the patch to make it look a little better :-)
> Will push to master tomorrow if no objections.
> 
> -----
> 
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
> index c987254d61..035d38ac5a 100644
> --- a/gnu/packages/installers.scm
> +++ b/gnu/packages/installers.scm
> @@ -48,6 +48,7 @@
>        (arguments
>         `(#:scons ,scons-python2
>           #:modules ((srfi srfi-1)
> +                    (srfi srfi-26)
>                      (guix build utils)
>                      (guix build scons-build-system))
>           #:tests? #f
> @@ -92,7 +93,19 @@
>                               ;; CROSS_-prefixed version of env vars
>                               (setenv (string-append "CROSS_" env-name)
>                                       (filter-delimited-string env-val mingw-path?))))
> -                         '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
> +                         '("CPATH" "LIBRARY_PATH"))
> +                        ;; Hack to place mingw-w64 path at the end of search
> +                        ;; paths.  Could probably use a specfile and dirafter
> +                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
> +                                (string-join
> +                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
> +                                          `("/include/c++"
> +                                            ,(string-append "/include/c++/" ,triplet)
> +                                            "/include/c++/backward"
> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include"
> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include-fixed"))
I'm going to suggest not hardcoding 7.4.0 here


> +                                   ,(getenv "CROSS_CPATH"))
> +                                 ":"))))
>                      (add-before 'build 'fix-target-detection
>                        (lambda _
>                          ;; NSIS target detection is screwed up, manually
> --
> 2.23.0
> 
> 
> 

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Tue, 29 Oct 2019 20:12:02 GMT) Full text and rfc822 format available.

Message #14 received at 37870 <at> debbugs.gnu.org (full text, mbox):

From: Carl Dong <contact <at> carldong.me>
To: "37870 <at> debbugs.gnu.org" <37870 <at> debbugs.gnu.org>
Subject: [PATCH v3] gnu: make-nsis: Fix cross-compilation.
Date: Tue, 29 Oct 2019 20:11:22 +0000
Updated the patch to address Efraim's suggestion.

-----

* gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
ordering of search paths (mingw-w64 last).
---
 gnu/packages/installers.scm | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
index c987254d61..9229359fdf 100644
--- a/gnu/packages/installers.scm
+++ b/gnu/packages/installers.scm
@@ -28,7 +28,10 @@
   #:use-module (guix utils))

 (define (make-nsis machine target-arch nsis-target-type)
-  (let ((triplet (string-append machine "-" "w64-mingw32")))
+  (let* ((triplet (string-append machine "-" "w64-mingw32"))
+         (xbinutils (cross-binutils triplet))
+         (xlibc (cross-libc triplet))
+         (xgcc (cross-gcc triplet #:libc xlibc)))
     (package
       (name (string-append "nsis-" machine))
       (version "3.04")
@@ -41,13 +44,14 @@
                   "1xgllk2mk36ll2509hd31mfq6blgncmdzmwxj3ymrwshdh23d5b0"))
                 (patches (search-patches "nsis-env-passthru.patch"))))
       (build-system scons-build-system)
-      (native-inputs `(("xgcc" ,(cross-gcc triplet #:libc (cross-libc triplet)))
-                       ("xbinutils" ,(cross-binutils triplet))
-                       ("mingw-w64" ,(cross-libc triplet))))
+      (native-inputs `(("xgcc" ,xgcc)
+                       ("xbinutils" ,xbinutils)
+                       ("mingw-w64" ,xlibc)))
       (inputs `(("zlib" ,zlib)))
       (arguments
        `(#:scons ,scons-python2
          #:modules ((srfi srfi-1)
+                    (srfi srfi-26)
                     (guix build utils)
                     (guix build scons-build-system))
          #:tests? #f
@@ -92,7 +96,20 @@
                              ;; CROSS_-prefixed version of env vars
                              (setenv (string-append "CROSS_" env-name)
                                      (filter-delimited-string env-val mingw-path?))))
-                         '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
+                         '("CPATH" "LIBRARY_PATH"))
+                        ;; Hack to place mingw-w64 path at the end of search
+                        ;; paths.  Could probably use a specfile and dirafter
+                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                                (string-join
+                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
+                                          `("/include/c++"
+                                            ,(string-append "/include/c++/" ,triplet)
+                                            "/include/c++/backward"
+                                            ,@(map (cut string-append "/lib/gcc/" ,triplet "/" ,(package-version xgcc) <>)
+                                                   '("/include"
+                                                     "/include-fixed"))))
+                                   ,(getenv "CROSS_CPATH"))
+                                 ":"))))
                     (add-before 'build 'fix-target-detection
                       (lambda _
                         ;; NSIS target detection is screwed up, manually
--
2.23.0




Information forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Wed, 30 Oct 2019 07:44:01 GMT) Full text and rfc822 format available.

Message #17 received at 37870 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Carl Dong <contact <at> carldong.me>
Cc: "37870 <at> debbugs.gnu.org" <37870 <at> debbugs.gnu.org>
Subject: Re: [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
Date: Wed, 30 Oct 2019 09:42:57 +0200
[Message part 1 (text/plain, inline)]
On Tue, Oct 29, 2019 at 08:11:22PM +0000, Carl Dong wrote:
> Updated the patch to address Efraim's suggestion.
> 
> -----
> 
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/gnu/packages/installers.scm b/gnu/packages/installers.scm
> index c987254d61..9229359fdf 100644
> --- a/gnu/packages/installers.scm
> +++ b/gnu/packages/installers.scm
> @@ -28,7 +28,10 @@
>    #:use-module (guix utils))
> 
>  (define (make-nsis machine target-arch nsis-target-type)
> -  (let ((triplet (string-append machine "-" "w64-mingw32")))
> +  (let* ((triplet (string-append machine "-" "w64-mingw32"))
> +         (xbinutils (cross-binutils triplet))
> +         (xlibc (cross-libc triplet))
> +         (xgcc (cross-gcc triplet #:libc xlibc)))
>      (package
>        (name (string-append "nsis-" machine))
>        (version "3.04")
> @@ -41,13 +44,14 @@
>                    "1xgllk2mk36ll2509hd31mfq6blgncmdzmwxj3ymrwshdh23d5b0"))
>                  (patches (search-patches "nsis-env-passthru.patch"))))
>        (build-system scons-build-system)
> -      (native-inputs `(("xgcc" ,(cross-gcc triplet #:libc (cross-libc triplet)))
> -                       ("xbinutils" ,(cross-binutils triplet))
> -                       ("mingw-w64" ,(cross-libc triplet))))
> +      (native-inputs `(("xgcc" ,xgcc)
> +                       ("xbinutils" ,xbinutils)
> +                       ("mingw-w64" ,xlibc)))
>        (inputs `(("zlib" ,zlib)))
>        (arguments
>         `(#:scons ,scons-python2
>           #:modules ((srfi srfi-1)
> +                    (srfi srfi-26)
>                      (guix build utils)
>                      (guix build scons-build-system))
>           #:tests? #f
> @@ -92,7 +96,20 @@
>                               ;; CROSS_-prefixed version of env vars
>                               (setenv (string-append "CROSS_" env-name)
>                                       (filter-delimited-string env-val mingw-path?))))
> -                         '("CPLUS_INCLUDE_PATH" "LIBRARY_PATH" "C_INCLUDE_PATH"))))
> +                         '("CPATH" "LIBRARY_PATH"))
> +                        ;; Hack to place mingw-w64 path at the end of search
> +                        ;; paths.  Could probably use a specfile and dirafter
> +                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
> +                                (string-join
> +                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
> +                                          `("/include/c++"
> +                                            ,(string-append "/include/c++/" ,triplet)
> +                                            "/include/c++/backward"
> +                                            ,@(map (cut string-append "/lib/gcc/" ,triplet "/" ,(package-version xgcc) <>)
> +                                                   '("/include"
> +                                                     "/include-fixed"))))
> +                                   ,(getenv "CROSS_CPATH"))
> +                                 ":"))))
>                      (add-before 'build 'fix-target-detection
>                        (lambda _
>                          ;; NSIS target detection is screwed up, manually

I haven't tested it, but it looks good to me

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Mon, 04 Nov 2019 22:12:02 GMT) Full text and rfc822 format available.

Message #20 received at 37870 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: "37870 <at> debbugs.gnu.org" <37870 <at> debbugs.gnu.org>,
 Carl Dong <contact <at> carldong.me>
Subject: Re: [bug#37870] [PATCH v2] gnu: make-nsis: Fix cross-compilation.
Date: Mon, 04 Nov 2019 23:11:22 +0100
Hi,

Efraim Flashner <efraim <at> flashner.co.il> skribis:

> On Tue, Oct 29, 2019 at 04:02:01PM +0000, Carl Dong wrote:
>> Updated the patch to make it look a little better :-)
>> Will push to master tomorrow if no objections.

[...]

>> +                        (setenv "CROSS_CPLUS_INCLUDE_PATH"
>> +                                (string-join
>> +                                 `(,@(map (cut string-append (assoc-ref %build-inputs "xgcc") <>)
>> +                                          `("/include/c++"
>> +                                            ,(string-append "/include/c++/" ,triplet)
>> +                                            "/include/c++/backward"
>> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include"
>> +                                            "/lib/gcc/x86_64-w64-mingw32/7.4.0/include-fixed"))
> I'm going to suggest not hardcoding 7.4.0 here

Agreed.  I guess you could extract the version number by calling
‘package-version’ on the dependency or something like that (on the
“host side”).

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Tue, 05 Nov 2019 13:59:03 GMT) Full text and rfc822 format available.

Message #23 received at 37870 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Carl Dong <contact <at> carldong.me>
Cc: "37870 <at> debbugs.gnu.org" <37870 <at> debbugs.gnu.org>
Subject: Re: [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
Date: Tue, 05 Nov 2019 14:58:47 +0100
Hi,

Carl Dong <contact <at> carldong.me> skribis:

> Updated the patch to address Efraim's suggestion.
>
> -----
>
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).

LGTM as well!

(I replied yesterday and hadn’t seen you had already posted an updated
patch—sorry about that!)

Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 16 Nov 2019 16:26:02 GMT) Full text and rfc822 format available.

Notification sent to Carl Dong <contact <at> carldong.me>:
bug acknowledged by developer. (Sat, 16 Nov 2019 16:26:02 GMT) Full text and rfc822 format available.

Message #28 received at 37870-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Carl Dong <contact <at> carldong.me>
Cc: "37870 <at> debbugs.gnu.org" <37870-done <at> debbugs.gnu.org>
Subject: Re: [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
Date: Sat, 16 Nov 2019 17:25:06 +0100
Carl Dong <contact <at> carldong.me> skribis:

> Updated the patch to address Efraim's suggestion.
>
> -----
>
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)

That was pushed as 2148674372cacc58fbb9d9914010cf0bd9376f1b, closing!

Ludo'.




Information forwarded to guix-patches <at> gnu.org:
bug#37870; Package guix-patches. (Sat, 16 Nov 2019 16:26:02 GMT) Full text and rfc822 format available.

Message #31 received at 37870-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Carl Dong <contact <at> carldong.me>
Cc: "37870 <at> debbugs.gnu.org" <37870-done <at> debbugs.gnu.org>
Subject: Re: [bug#37870] [PATCH v3] gnu: make-nsis: Fix cross-compilation.
Date: Sat, 16 Nov 2019 17:25:32 +0100
Carl Dong <contact <at> carldong.me> skribis:

> Updated the patch to address Efraim's suggestion.
>
> -----
>
> * gnu/packages/installers.scm (make-nsis)[arguments]: Enforce correct
> ordering of search paths (mingw-w64 last).
> ---
>  gnu/packages/installers.scm | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)

That was pushed as 2148674372cacc58fbb9d9914010cf0bd9376f1b, closing!

Ludo'.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 15 Dec 2019 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 124 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.