public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: papadave <papadavecn@gmail.com>
To: Kai Ruottu <kai.ruottu@wippies.com>, gcc-help@gcc.gnu.org
Subject: Re: Cross build gcc failed.build=x86_64-freebsd target=x86_64-solaris
Date: Wed, 23 Sep 2020 00:07:40 +0800	[thread overview]
Message-ID: <CAGx1O9DMjsatnBGX3c-K5msLa=pRVpCsKAPJU=BAgSk=+qH_ew@mail.gmail.com> (raw)
In-Reply-To: <a7b23484-b12e-123d-727f-96c5c879f066@wippies.com>

Thanks for your reply. But I think it is more like a multilib issue. GCC
build system failed to find amd64 objects in 'amd64' subdirectory.

Kai Ruottu <kai.ruottu@wippies.com> 于2020年9月22日周二 下午11:37写道:

> papadave via Gcc-help kirjoitti 22.9.2020 klo 17.41:
> > Hello,
> > Recently I was trying to cross build a latest gcc on FreeBSD amd64 ,and
> > target is x86_64 Solaris. I built the binutils with following configure:
> >
> > ../configure --build=x86_64-unknown-freebsd12
> > --target=x86_64-unknown-solaris2.11 --prefix=/opt/toolchains
> > --sysconfdir=/etc --localstatedir=/var --libexecdir='${prefix}/lib'
> > --with-system-zlib --with-gmp=/usr/local --with-mpfr=/usr/local
> > --disable-rpath --enable-deterministic-archives --enable-nls
> --enable-gold
> > --enable-ld --enable-plugins
> >
> > Later I configured the gcc in a new subdirectory as follows:
> >
> > ../gcc-10.2.0/configure --build=x86_64-unknown-freebsd12
> > --target=x86_64-unknown-solaris2.11 --disable-bootstrap
> > --enable-gnu-indirect-function --prefix=/opt/toolchains --sysconfdir=/etc
> > --localstatedir=/var --libexecdir='${prefix}/lib/gcc' --disable-rpath
> > --program-prefix=x86_64-unknown-solaris2.11- --program-suffix=-10.2
> > --with-gnu-as --with-gnu-ld --with-gmp=/usr/local
> --with-pkgversion=Rivoreo
> > --with-system-zlib --enable-languages=c,c++,objc,fortran,obj-c++,go
> > --enable-multilib
>
>
> Ok, for a crosscompiler one needs just the same target C library stuff
> (here for
> x86_64-unknown-solaris2.11) as is needed in a native GCC build for the
> target.
> Usually it will be copied/unpacked into a chosen $sysroot on the host
> machine
> (here x86_64-unknown-freebsd12).  And a "--with-sysroot=$sysroot" option is
> given both in binutils and GCC configure commands to tell to "ld" and "gcc"
> where the target libraries and headers are.  In your case choosing the
> "/opt/toolchains/host-x86_64-unknown-solaris2.11" as the $sysroot could be
> one choice if your aim is to put more crosstoolchains for all kind of
> targets into
> the "/opt/toolchains".  And use the "/opt/toolchains/host-$target" as the
> standard for the install places for their C libraries.
>
> I remember the "native install" for Solaris2.x C library being quite
> complicated so using
> the default "$prefix/$target/include" and "$prefix/$target/lib" would
> need some
> scratching of one's head to get everything in the Solaris2.x C library
> being found
> there.  Much easier is to let it be similar to the native scheme in the
> $sysroot
> (the cross "/" is the $sysroot on the host system).
>
> > -B/opt/toolchains/x86_64-unknown-solaris2.11/bin/
> > -B/opt/toolchains/x86_64-unknown-solaris2.11/lib/
> > -isystem /opt/toolchains/x86_64-unknown-solaris2.11/include
> > -isystem /opt/toolchains/x86_64-unknown-solaris2.11/sys-include
>
> These tell where the target C library will be searched now. Please don't
> ask for what
> purpose the "sys-include" is there.  Just take it as a relic from the
> ancient time when
> someone maybe knew why he/she needed it :) The funny thing is that it
> will be searched
> before the "include" unless the order is the same as given in the
> "-isystem <dir>" options
> (the old order was changed in the 'gcc/cppdefaults.c' or something).
>
>

      reply	other threads:[~2020-09-22 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 14:41 papadave
2020-09-22 15:37 ` Kai Ruottu
2020-09-22 16:07   ` papadave [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='CAGx1O9DMjsatnBGX3c-K5msLa=pRVpCsKAPJU=BAgSk=+qH_ew@mail.gmail.com' \
    --to=papadavecn@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=kai.ruottu@wippies.com \
    /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.
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).