From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Trofimovich Subject: Re: 'guix build --target=' handling questions Date: Wed, 22 Feb 2017 22:54:22 +0000 Message-ID: <20170222225422.2d1020ba@sf> References: <20170221214035.6cd9f180@sf> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/k/8/OcyOSXSGPrsSftJjUpB"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgfo0-0006wB-JW for guix-devel@gnu.org; Wed, 22 Feb 2017 17:54:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgfnv-0005wR-Je for guix-devel@gnu.org; Wed, 22 Feb 2017 17:54:40 -0500 Received: from smtp21.mail.ru ([94.100.179.250]:45882) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgfnv-0005vP-6o for guix-devel@gnu.org; Wed, 22 Feb 2017 17:54:35 -0500 Received: from host86-186-94-114.range86-186.btcentralplus.com ([86.186.94.114]:44178 helo=sf) by smtp21.mail.ru with esmtpa (envelope-from ) id 1cgfnq-00078M-5f for guix-devel@gnu.org; Thu, 23 Feb 2017 01:54:31 +0300 In-Reply-To: <20170221214035.6cd9f180@sf> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --Sig_/k/8/OcyOSXSGPrsSftJjUpB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable > Question time: >=20 > - Is there a way to run 'guix environment --target=3D' in the same way as= 'guix build --target=3D' > sets it up? I'd like to see how both compilers are supposed to be prese= nt 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. >=20 > - 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=3D" <.?.>))=20 > 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 (package (name "re2") (version "2017-01-01") @@ -40,11 +42,15 @@ "0yij1ajh66h3pj3kfz7y0ldrsww8rlpjzaavyr5lchl98as1jq74")))) (build-system gnu-build-system) (arguments `(#:test-target "test" ;; There is no configure step, but the Makefile respects a prefix. - #:make-flags (list (string-append "prefix=3D" %output)) + #:make-flags (list (string-append "prefix=3D" %output) + (string-append "CXX=3D" ,(string-append (if (%c= urrent-target-system) + (stri= ng-append (%current-target-system) "-") + "") + "g++"))) #:phases (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? --=20 Sergei --Sig_/k/8/OcyOSXSGPrsSftJjUpB Content-Type: application/pgp-signature Content-Description: Цифровая подпись OpenPGP -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAliuFp4ACgkQcaHudmEf86qmowCdEYL3DSyLf/Ou1OrlDQJrD22Y fuAAn3XoifDKPxmP1eiaw7TntlrXzlKG =nQJP -----END PGP SIGNATURE----- --Sig_/k/8/OcyOSXSGPrsSftJjUpB--