public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "R. Diez" <rdiezmail-gcc@yahoo.de>
Cc: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: Specifying where Binutils is and what it is called
Date: Sun, 19 Apr 2020 19:49:35 +0100	[thread overview]
Message-ID: <CAH6eHdSGBuVJ6CwjuvL3vDWTnX0NvLfVC68ayLju-cEx_WBZ2w@mail.gmail.com> (raw)
In-Reply-To: <921250919.1086849.1587309283539@mail.yahoo.com>

On Sun, 19 Apr 2020 at 16:16, R. Diez via Gcc-help <gcc-help@gcc.gnu.org> wrote:
>
> Hi all:
>
> I have been building cross-compiler toolchains for years with makefiles similar to this one:
>
> https://github.com/rdiez/JtagDue/blob/master/Toolchain/Makefile
>
> I have always been worried that installing GCC phase 2 on top of GCC phase 1 (with the same --prefix=/my/dir) may leave some undesired remnants behind.

That seems like an unnecessary worry. Why would the phase 1 compiler
install *more* than the final one?

> So I thought I should build and install GCC phase 1 somewhere else. After all, GCC phase 1 is not needed after the toolchain is complete.
>
> The steps would look like this:
>
> - Build and install Binutils with --prefix=/final/destination
> - Build and install GCC phase 1 (minimal compiler) with --prefix=/temporary/destination
> - Build and install Newlib with GCC phase 1 with --prefix=/final/destination
> - Build and install GCC phase 2 with --prefix=/final/destination
> - At this point, we could delete /temporary/destination
>
> Unfortunately, I am having trouble with GCC phase 1 and Newlib:
>
> a) If I configure GCC phase 1 with --prefix=/final/destination, it picks up the Binutils correctly.
>
> The names it finds are arm-none-eabi-ar etc.

Right, that's how it should work.

> But that is not what I want after all.

Why not?

> b) If I configure GCC phase 1 with --prefix=/temporary/destination, it does not find arm-none-eabi-ar and the like, even if they are in the PATH.
>
> It then picks up 'ar' for the host. Compilation fails later on with a message like this:
>
> Assembler messages:
> Fatal error: invalid -march= option: `armv7-m'
>
> It took some time to build everything and to realise what the error cause was. I wish that GCC checked during the configuration phase that the found 'ar' etc. actually support the asked target architecture.
>
> c) I can specify --with-build-time-tools=/some/dir , but then GCC does not pick full names like arm-none-eabi-ar . I have to specify a path like /home/rdiez/rdiez/arduino/toolchain-test-09-bin/arm-none-eabi/bin , which contains the same tools but with short names like "ar".
>
> The trouble is, GCC needs then those 'ar' etc. tool on the path when building Newlib. Because 'ar' for the host has then the same name as 'ar' for the cross-compilation target, the host tools are not available anymore, which causes problems later on. I really need --with-build-time-tools to pick full names like "arm-none-eabi-ar".
>
> d) I guess I could use --with-as and --with-ld to manually specify the right Binutils. The trouble is, there are other tools like objdump. GCC's own documentation warns about this:
>
> "When you use this option, you should ensure that dir includes ar, as, ld, nm, ranlib and strip if necessary, and possibly objdump. Otherwise, GCC may use an inconsistent set of tools."
>
> e) I could use the same --prefix for both GCC phase 1 and phase 2, delete the /final/destination when Newlib is complete, and reinstall to that /final/destination Binutils, Newlib and GCC phase 2. But that does not play well with Makefiles that are building in parallel. So I wish there is another way.

Why bother with the deleting things step?

  reply	other threads:[~2020-04-19 18:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <921250919.1086849.1587309283539.ref@mail.yahoo.com>
2020-04-19 15:14 ` R. Diez
2020-04-19 18:49   ` Jonathan Wakely [this message]
2020-04-20  5:25     ` Kai Ruottu
2020-04-20  5:32       ` Kai Ruottu
2020-04-20 18:55   ` Jim Wilson
     [not found] <590749852.1515706.1587371249089.ref@mail.yahoo.com>
2020-04-20  8:27 ` R. Diez
2020-04-20  8:47   ` Jonathan Wakely
     [not found] <2007965762.1537196.1587376378163.ref@mail.yahoo.com>
2020-04-20  9:52 ` R. Diez
     [not found] <238241866.1719021.1587558240444.ref@mail.yahoo.com>
2020-04-22 12:24 ` R. Diez
2020-04-23  8:24   ` Christer Solskogen

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=CAH6eHdSGBuVJ6CwjuvL3vDWTnX0NvLfVC68ayLju-cEx_WBZ2w@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=rdiezmail-gcc@yahoo.de \
    /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).