From: Marius Bakke <mbakke@fastmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: Crosscompiling C++ for powerpc64le fails
Date: Thu, 06 Jun 2019 20:35:53 +0200 [thread overview]
Message-ID: <87ftom7e9i.fsf@devup.no> (raw)
In-Reply-To: <878sug41zk.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 1714 bytes --]
Ludovic Courtès <ludo@gnu.org> writes:
> Hi Marius,
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>
> [...]
>
>>> The issue that Tobias reports reminds me of the CPATH vs. C_INCLUDE_PATH
>>> issue that was causing troubles with newer GCCs, and that I think Marius
>>> addressed in ‘core-updates’ (?). Marius, does that ring a bell?
>>
>> Unfortunately there are still issues with cross-compiling C++ on
>> 'core-updates'. For 'C', the workaround was to go back to "CROSS_CPATH"
>> instead of "CROSS_C_INCLUDE_PATH", like with native builds.
>
> That should also address C++, since CPATH (and CROSS_CPATH) are for all
> language front-ends, no just C, no?
Indeed. The cross-compilation problems are unrelated.
>> For native builds on core-updates, GCC7 occasionally fails if the libc
>> or kernel headers are not on C_INCUDE_PATH (see e.g. f90d6c3). It could
>> be that cross builds need a similar workaround, but I have not found the
>> magic incantation yet.
>
> How can it be that kernel headers are not on C_INCLUDE_PATH (or CPATH)?
Sorry, this was a red herring. :-)
(Kernel headers are of course on CPATH because they are propagated from
glibc, but adding them on C_INCLUDE_PATH works around some corner cases
because GCC disables warnings for such headers, which is expected by
some build scripts.)
I expected the problem with GCC not finding target libc headers to be a
matter of getting it on CROSS_CPLUS_INCLUDE_PATH, just like we had to
set C_INCLUDE_PATH for GCC 7's build processes to find libc.
But, looking at this issue with a fresh mind I managed to locate the
problem, and a one-liner fix:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-cross-base-Fix-C-cross-compilation-problems-with.patch --]
[-- Type: text/x-patch, Size: 1897 bytes --]
From dcdedf8d8460a032c0333f6050626a41b39ff461 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 6 Jun 2019 19:33:05 +0200
Subject: [PATCH] gnu: cross-base: Fix C++ cross-compilation problems with GCC
7.
* gnu/packages/cross-base.scm (cross-gcc-arguments)[#:configure-flags]: Add
"--with-sysroot=/".
---
gnu/packages/cross-base.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 9fcf3bd780..0bd0cb3987 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -120,7 +120,15 @@ base compiler and using LIBC (which may be either a libc package or #f.)"
,@(if libc
`( ;; Disable libcilkrts because it is not
;; ported to GNU/Hurd.
- "--disable-libcilkrts")
+ "--disable-libcilkrts"
+ ;; When building a cross compiler, --with-sysroot is
+ ;; implicitly set to "$gcc_tooldir/sys-root". This does
+ ;; not work for us, because --with-native-system-header-dir
+ ;; is searched for relative to this location. Thus, we set
+ ;; it to "/" so GCC is able to find the target libc headers.
+ ;; This is safe because in practice GCC uses CROSS_CPATH
+ ;; & co to separate target and host libraries.
+ "--with-sysroot=/")
`( ;; Disable features not needed at this stage.
"--disable-shared" "--enable-static"
"--enable-languages=c,c++"
--
2.21.0
[-- Attachment #1.3: Type: text/plain, Size: 201 bytes --]
WDYT?
Cross-compiling bootstrap-tarballs still does not work, but I think we
just need to reinstate some known workarounds... Will look into it the
coming days so we can get this branch rolling :-)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
prev parent reply other threads:[~2019-06-06 18:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 16:07 Crosscompiling C++ for powerpc64le fails Tobias Platen
2019-05-28 18:31 ` Danny Milosavljevic
2019-05-29 10:10 ` Danny Milosavljevic
2019-05-31 21:54 ` Ludovic Courtès
2019-06-03 18:30 ` Marius Bakke
2019-06-05 13:04 ` Ludovic Courtès
2019-06-06 18:35 ` Marius Bakke [this message]
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=87ftom7e9i.fsf@devup.no \
--to=mbakke@fastmail.com \
--cc=guix-devel@gnu.org \
--cc=ludo@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.