* riscv cross toolchain - C_INCLUDE_PATH
@ 2016-12-30 18:52 David Craven
2017-01-02 21:24 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: David Craven @ 2016-12-30 18:52 UTC (permalink / raw)
To: guix-devel
Hi guix,
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")))))))))))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: riscv cross toolchain - C_INCLUDE_PATH
2016-12-30 18:52 riscv cross toolchain - C_INCLUDE_PATH David Craven
@ 2017-01-02 21:24 ` Ludovic Courtès
2017-01-07 18:32 ` David Craven
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-01-02 21:24 UTC (permalink / raw)
To: David Craven; +Cc: guix-devel
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’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: riscv cross toolchain - C_INCLUDE_PATH
2017-01-02 21:24 ` Ludovic Courtès
@ 2017-01-07 18:32 ` David Craven
0 siblings, 0 replies; 3+ messages in thread
From: David Craven @ 2017-01-07 18:32 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ah yes it makes more sense now, thank you!
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-07 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-30 18:52 riscv cross toolchain - C_INCLUDE_PATH David Craven
2017-01-02 21:24 ` Ludovic Courtès
2017-01-07 18:32 ` David Craven
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).