Re: How to build a 64-bit gcc on a hybrid 32-bit/64-bit (Intel) GNU/Linux system

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

 



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

/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=/

This still compiled and installed fine.  But the next logical step was
to configure the 64-bit compiler with

/usr/local/src/gcc-4.9.4/configure \
  --target=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu \
  --build=i686-unknown-linux-gnu --prefix=/opt/gcc-4.9.4-64bit \
  --with-sysroot=/ --enable-languages=c,c++

and this time "make" did not succeed:

<...>
checking for ssize_t... yes
checking for pid_t... yes
checking for library containing strerror... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:2469: recipe for target 'configure-build-libiberty' failed
make[1]: *** [configure-build-libiberty] Error 1
make[1]: Leaving directory '/tmp/gcc-build'
Makefile:863: recipe for target 'all' failed
make: *** [all] Error 2

I'm a bit confused as to what is happening here: configure thinks it
cannot perform runtime tests for the host system because it is
different from the build system, right?

I can provide more details, but do the above steps make sense?  I
think this is what one is supposed to do to cross-compile gcc, but I
have never done it.

> You should also be able to disable the use of any linker plugins, but
> that shouldn't be necessary

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).

Happy hacking,

-- 
     David A. Madore
   ( http://www.madore.org/~david/ )



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux