all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: David Craven <david@craven.ch>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: riscv cross toolchain - C_INCLUDE_PATH
Date: Mon, 02 Jan 2017 22:24:27 +0100	[thread overview]
Message-ID: <87o9zp9mus.fsf@gnu.org> (raw)
In-Reply-To: <CAL1_immMvhuLgzsW25T9s8NYEwQ1h=+eXodpEM=+BcBb3n+A9Q@mail.gmail.com> (David Craven's message of "Fri, 30 Dec 2016 19:52:52 +0100")

Hi!

David Craven <david@craven.ch> skribis:

> I'm trying to build a riscv cross toolchain. Why do I have to reset
> C_INCLUDE_PATH to get glibc to build? It seems to me that all the
> cross packages shouldn't be in the C_INCLUDE_PATH. Some insight would
> be greatly appreciated.
>
> export C_INCLUDE_PATH="/gnu/store/sjg2km4jy29wbwpisaab8z0jl5h9v9mn-riscv-glibc-2.24.90-1.e84d3a5-checkout/include:/gnu/store/7nqgj7nz2ypl7dwmjkx0hswbjf0w1a63-gcc-cross-sans-libc-riscv64-unknown-linux-gnu-6.1.0-1.287c5cb/include:/gnu/store/pd7w87bjcq2n4dr481gk14d4y1p2iiaz-binutils-cross-riscv64-unknown-linux-gnu-2.27-1.8c5f683/include:/gnu/store/zpkwh5b3b3hrlpckdpb0givgqg5rf8gn-gettext-minimal-0.19.8.1/include:/gnu/store/d5nscny560slzpljixqzim6b8ms7hhv2-bzip2-1.0.6/include:/gnu/store/4yg6q1kp856m68arkpqc85hqgbffhpxf-xz-5.2.2/include:/gnu/store/06icf5h4z83mw5g17a58fy26z14dsj9z-file-5.28/include:/gnu/store/k03y1lfaj1xw0d7j2lxdil8ii5c67fdy-gawk-4.1.4/include:/gnu/store/c5ihjcdxsm9086323bn2j67v7z34lc1a-make-4.2.1/include:/gnu/store/4xxd00drj8gjcr84xdfna44qak2vhwmf-binutils-2.27/include:/gnu/store/y1g6991kxvdk4vxhsq07r5saww30v8dq-gcc-4.9.4/include:/gnu/store/iwgi9001dmmihrjg4rqhd6pa6788prjw-glibc-2.24/include:/gnu/store/p1qnhavlg6d9mgv6569c8pici37v2dak-linux-libre-headers-cross-riscv64-unknown-linux-gnu-4.4.18/include:/gnu/store/jc898psn5yc9s328nn8fya3sc2daf037-linux-libre-headers-4.4.18/include"
>
> (define-public (riscv-cross-glibc target)
>   (let ((glibc (cross-libc target
>                            (riscv-cross-gcc target)
>                            (riscv-cross-binutils target)
>                            (riscv-cross-kernel-headers target)))
>         (commit "e84d3a58c42e29cc162efa0446bb0a1e3554dde4")
>         (revision "1"))
>     (package
>       (inherit glibc)
>       (version (string-append "2.24.90-" revision "."
>                               (string-take commit 7)))
>       (source (origin
>                 (method git-fetch)
>                 (uri (git-reference
>                       (url "https://github.com/riscv/riscv-glibc")
>                       (commit commit)))
>                 (file-name (string-append "riscv-glibc-" version "-checkout"))
>                 (sha256
>                  (base32
>                   "0pbg4f7y7l5kwvb6z8c7s6cp8nrypkvz6cgcc2m03k671p1zwgpi"))))
>       (arguments
>        (substitute-keyword-arguments (package-arguments glibc)
>          ((#:configure-flags configure-flags)
>           `(cons "--disable-werror" ,configure-flags))
>          ((#:phases phases)
>           `(modify-phases ,phases
>              (add-before 'build 'reset-c-include-path
>                (lambda* (#:key inputs #:allow-other-keys)
>                  (setenv "C_INCLUDE_PATH"
>                          (string-append (assoc-ref inputs "kernel-headers")
>                                         "/include")))))))))))

‘cross-libc’ in cross-base.scm does that dance too, but that’s because
it’s a “special case.”

In GNU terminology, there’s the “build”, “host”, and “target”.  However,
Guix only knows of “system” and “target” (and input/native-input, and
search-paths/native-search-paths).  So to build the cross-toolchain we
need this special hack, which is admittedly ugly.

(guix build-systems) has a comment on this, in the definition of <bag>.

The initial thought was that we don’t need to expose build/host/target
at the package level, and that native/target is enough.

Suggestions are welcome though!

Thanks,
Ludo’.

  reply	other threads:[~2017-01-02 21:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-30 18:52 riscv cross toolchain - C_INCLUDE_PATH David Craven
2017-01-02 21:24 ` Ludovic Courtès [this message]
2017-01-07 18:32   ` David Craven

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=87o9zp9mus.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=david@craven.ch \
    --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.