[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'guix build --target=' handling questions

From: Sergei Trofimovich
Subject: Re: 'guix build --target=' handling questions
Date: Wed, 22 Feb 2017 22:54:22 +0000

> Question time:
> - Is there a way to run 'guix environment --target=' in the same way as 'guix 
> build --target='
>   sets it up? I'd like to see how both compilers are supposed to be present 
> in there.
> - Why default g++ in PATH is the host g++ and not target g++?
>   Target seems to make most sense if no explicit compiler is specified.
> - How to actually set CXX to point to target g++?
>   It looks like implicitly there already both host (through native-inputs)
>   and target (through build-inputs) compilers available.
>   I would expect something like
>       #:make-flags (list (string-append "CXX=" <.?.>)) 
>   What should be in place of that "<.?.>" to refer to target g++?

I think I've found a workaround at least for my third question.

Both host and target compilers are available as g++ and ${target}-g++.

Thus the following workaround seems to work:

diff --git a/gnu/packages/regex.scm b/gnu/packages/regex.scm
index f04cba706..a8fa689ab 100644
--- a/gnu/packages/regex.scm
+++ b/gnu/packages/regex.scm
@@ -20,11 +20,13 @@

 (define-module (gnu packages regex)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils) ; for %current-target-system
+  )

 (define-public re2
      (name "re2")
      (version "2017-01-01")
@@ -40,11 +42,15 @@
      (build-system gnu-build-system)
       `(#:test-target "test"
         ;; There is no configure step, but the Makefile respects a prefix.
-        #:make-flags (list (string-append "prefix=" %output))
+        #:make-flags (list (string-append "prefix=" %output)
+                           (string-append "CXX=" ,(string-append (if 
(string-append (%current-target-system) "-")
+                                                                     "")
+                                                                 "g++")))
         (modify-phases %standard-phases
           (delete 'configure)
           (add-after 'install 'delete-static-library
             (lambda* (#:key outputs #:allow-other-keys)

It looks clumsy and potentially requires more tools to be wrapped like that.

At least 'ar' for this package. Perhaps there is a function that already
adds a "${target}-" and I've missed it?



Attachment: pgppjrly3aRZG.pgp
Description: Цифровая подпись OpenPGP

reply via email to

[Prev in Thread] Current Thread [Next in Thread]