guix-devel
[Top][All Lists]
Advanced

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

Re: riscv cross toolchain - C_INCLUDE_PATH


From: Ludovic Courtès
Subject: Re: riscv cross toolchain - C_INCLUDE_PATH
Date: Mon, 02 Jan 2017 22:24:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi!

David Craven <address@hidden> 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 via email to

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