This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to build a 64-bit gcc on a hybrid 32-bit/64-bit (Intel) GNU/Linux system
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: David Madore <david+ml at madore dot org>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 10 Mar 2017 19:38:23 +0000
- Subject: Re: How to build a 64-bit gcc on a hybrid 32-bit/64-bit (Intel) GNU/Linux system
- Authentication-results: sourceware.org; auth=none
- References: <20170310175630.GA6426@achernar.madore.org> <CAH6eHdS2QF8QqrFuHe+AbB389bqsbiAruNSy2FY=z_Hy2vYCvQ@mail.gmail.com> <20170310185632.GA6593@achernar.madore.org>
On 10 March 2017 at 18:56, David Madore wrote:
> On Fri, Mar 10, 2017 at 06:01:38PM +0000, Jonathan Wakely wrote:
>> On 10 March 2017 at 17:56, David Madore wrote:
>> > What would be the correct way to achieve this?
>>
>> Can you install a 64-bit binutils first? Configure it with the same
>> --prefix as you intend to use for the new GCC and install it. GCC
>> should pick that up automatically when you configure it.
>
> I tried the following:
>
> First, I configured binutils-2.25.1 (to serve as cross-binutils) with
I'm not convinced you need a cross-anything.
> /usr/local/src/binutils-2.25.1/configure \
> --target=x86_64-unknown-linux-gnu --host=i686-unknown-linux-gnu \
> --build=i686-unknown-linux-gnu --prefix=/opt/binutils-2.25.1-32cross64 \
> --enable-shared --enable-plugins --with-sysroot=/
>
> (I'm rather clueless as to the choice of options, so if this was
> stupid, please tell me!)
>
> This part went fine (make and make install). I then added
> /opt/binutils-2.25.1-32cross64/bin at the front of my $PATH and
> configured gcc-4.9.4 (to serve as a cross-compiler) with
>
> /usr/local/src/gcc-4.9.4/configure \
> --target=x86_64-unknown-linux-gnu --host=i686-unknown-linux-gnu \
> --build=i686-unknown-linux-gnu --prefix=/opt/gcc-4.9.4-32cross64 \
> --with-sysroot=/ --enable-languages=c,c++
>
> Again, make and make install worked fine. Then I added
> /opt/gcc-4.9.4-32cross64/bin to the front of $PATH and configured
> another set of binutils (to serve as 64-bit binutils) with
>
> /usr/local/src/binutils-2.25.1/configure \
> --target=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu \
> --build=i686-unknown-linux-gnu --prefix=/opt/binutils-2.25.1-64bit \
> --enable-shared --enable-plugins --with-sysroot=/
Instead of doing this, what happens if you just do a native build
(i.e. no --target or --host or --build options)?
You already have a 64-bit binutils and 64-bit gcc in your path now, right?
Although maybe because you built them as crosses they only installed
x86_64-unknown-linux-gnu-gcc etc. and not just "gcc" etc. but you
could solve that with some symlinks.
> I don't even know what linker plugins are... But I would like the
> final gcc to be as identical as possible to one that would have been
> compiled on a 64-bit system (I'm willing to go through several
> bootstrap stages, though).
Isn't the obvious way to get that to install the Debian 64-bit gcc packages?