From: Sergei Trofimovich <slyfox@inbox.ru>
To: guix-devel@gnu.org
Subject: 'guix build --target=' handling questions
Date: Tue, 21 Feb 2017 21:40:35 +0000 [thread overview]
Message-ID: <20170221214035.6cd9f180@sf> (raw)
[-- Attachment #1: Type: text/plain, Size: 2907 bytes --]
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=25799 ]
I've stumbled upon the two cases: working[1] and non-working[2].
[1] working:
$ ./pre-inst-env guix build --check re2c --target=alpha-unknown-linux-gnu --no-grafts
...
/gnu/store/15ibxf5xzcqzfx0xgb5s6qa5z2ah3avg-re2c-0.16
$ file /gnu/store/15ibxf5xzcqzfx0xgb5s6qa5z2ah3avg-re2c-0.16/bin/re2c
/gnu/store/15ibxf5xzcqzfx0xgb5s6qa5z2ah3avg-re2c-0.16/bin/re2c: ELF 64-bit LSB executable,
Works as expected.
[2] non-working:
$ ./pre-inst-env guix build --check re2 --target=alpha-unknown-linux-gnu --no-grafts
...
/gnu/store/mg474j0gx56fdl6wrpaxxxwsdknl7k2i-re2-2017-01-01
$ file /gnu/store/mg474j0gx56fdl6wrpaxxxwsdknl7k2i-re2-2017-01-01/lib/libre2.so.0.0.0
/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#n27
(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=" %output))
#:phases
(modify-phases %standard-phases
(delete 'configure)
As we see here definition skips ./configure step (that's ok)
and does not pass CXX=${target}-g++ to make flag.
I wonder what are the possible options to override CXX here?
Makefile for re2 is very straightforward:
CXX?=g++
...
obj/%.o: %.cc $(HFILES)
<tab>@mkdir -p $$(dirname $@)
<tab>$(CXX) -c -o $@ $(CPPFLAGS) $(RE2_CXXFLAGS) $(CXXFLAGS) -DNDEBUG $*.cc
...
obj/so/libre2.$(SOEXT): $(SOFILES)
<tab>@mkdir -p obj/so
<tab>$(MAKE_SHARED_LIBRARY) -o obj/so/libre2.$(SOEXTVER) $(SOFILES)
<tab>ln -sf libre2.$(SOEXTVER) $@
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++?
Thank you!
--
Sergei
[-- Attachment #2: Цифровая подпись OpenPGP --]
[-- Type: application/pgp-signature, Size: 163 bytes --]
next reply other threads:[~2017-02-21 21:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 21:40 Sergei Trofimovich [this message]
2017-02-22 22:54 ` 'guix build --target=' handling questions Sergei Trofimovich
2017-02-23 17:07 ` John Darrington
2017-03-06 16:04 ` Ludovic Courtès
2017-03-06 22:01 ` Sergei Trofimovich
2017-03-07 14:48 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170221214035.6cd9f180@sf \
--to=slyfox@inbox.ru \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.