From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Trofimovich Subject: 'guix build --target=' handling questions Date: Tue, 21 Feb 2017 21:40:35 +0000 Message-ID: <20170221214035.6cd9f180@sf> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/KJC+QagkrjJGQBe0ZsNQ0Lh"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgIBA-00083g-Ou for guix-devel@gnu.org; Tue, 21 Feb 2017 16:41:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgIB5-0002mb-Tv for guix-devel@gnu.org; Tue, 21 Feb 2017 16:41:00 -0500 Received: from smtp59.i.mail.ru ([217.69.128.39]:42940) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgIB5-0002lz-H2 for guix-devel@gnu.org; Tue, 21 Feb 2017 16:40:55 -0500 Received: from host86-186-94-114.range86-186.btcentralplus.com ([86.186.94.114]:43116 helo=sf) by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1cgIB1-0000us-V0 for guix-devel@gnu.org; Wed, 22 Feb 2017 00:40:52 +0300 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_/KJC+QagkrjJGQBe0ZsNQ0Lh Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hia! Before asking my questions I'll setup the scene first. The scene: I'm playing with cross-compiler support in guix. [ x86_64 -> alpha target as an example with this tiny patch: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D25799 ] I've stumbled upon the two cases: working[1] and non-working[2]. [1] working: $ ./pre-inst-env guix build --check re2c --target=3Dalpha-unknown-linux-g= nu --no-grafts ... /gnu/store/15ibxf5xzcqzfx0xgb5s6qa5z2ah3avg-re2c-0.16 $ file /gnu/store/15ibxf5xzcqzfx0xgb5s6qa5z2ah3avg-re2c-0.16/bin/re2c=20 /gnu/store/15ibxf5xzcqzfx0xgb5s6qa5z2ah3avg-re2c-0.16/bin/re2c: ELF 64-bi= t LSB executable, Works as expected. [2] non-working: $ ./pre-inst-env guix build --check re2 --target=3Dalpha-unknown-linux-gn= u --no-grafts ... /gnu/store/mg474j0gx56fdl6wrpaxxxwsdknl7k2i-re2-2017-01-01 $ file /gnu/store/mg474j0gx56fdl6wrpaxxxwsdknl7k2i-re2-2017-01-01/lib/lib= re2.so.0.0.0=20 /gnu/store/mg474j0gx56fdl6wrpaxxxwsdknl7k2i-re2-2017-01-01/lib/libre2.so.= 0.0.0: ELF 64-bit LSB shared object, x86-64 It seems that re2 derivation ignores --target and builds it's library with host compiler, not target compiler. Relevant re2 package snippet from http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/regex.scm#n= 27 (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)) #:phases (modify-phases %standard-phases (delete 'configure) As we see here definition skips ./configure step (that's ok) and does not pass CXX=3D${target}-g++ to make flag. I wonder what are the possible options to override CXX here? Makefile for re2 is very straightforward: CXX?=3Dg++ ... obj/%.o: %.cc $(HFILES) @mkdir -p $$(dirname $@) $(CXX) -c -o $@ $(CPPFLAGS) $(RE2_CXXFLAGS) $(CXXFLAGS) -DNDEBUG $= *.cc ... obj/so/libre2.$(SOEXT): $(SOFILES) @mkdir -p obj/so $(MAKE_SHARED_LIBRARY) -o obj/so/libre2.$(SOEXTVER) $(SOFILES) ln -sf libre2.$(SOEXTVER) $@ Question time: - 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 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=3D" <.?.>))=20 What should be in place of that "<.?.>" to refer to target g++? Thank you! --=20 Sergei --Sig_/KJC+QagkrjJGQBe0ZsNQ0Lh Content-Type: application/pgp-signature Content-Description: Цифровая подпись OpenPGP -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAliss9MACgkQcaHudmEf86pQMwCZAegDfQMoN8HF9P0CWYFH6Rnx UPMAnRdWdMrdNmqhh8pk1yAHBRzUHPWk =D/5u -----END PGP SIGNATURE----- --Sig_/KJC+QagkrjJGQBe0ZsNQ0Lh--