mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Michael Forney <mforney@mforney.org>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Re: [musl-cross-make] [PATCH v2] litecross: Fix system header dir when building native toolchains
Date: Wed, 13 May 2020 12:34:23 -0700	[thread overview]
Message-ID: <CAGw6cBuGHa3KUhHCnKx5U5Wqh1awPKFwDhRiM5W8e7rL+1Cqhw@mail.gmail.com> (raw)
In-Reply-To: <20200513185551.GZ21576@brightrain.aerifal.cx>

On 2020-05-13, Rich Felker <dalias@libc.org> wrote:
> On Wed, May 13, 2020 at 11:48:57AM -0700, Michael Forney wrote:
>> It is not relative to /, it is relative to the sysroot, which is
>> determined dynamically based on the location of the compiler binary.
>
> Yes, and what that means is that use of sysroot is just completely
> wrong for NATIVE=y. I was under the impression that sysroot was
> necessary for making a relocatable toolchain but I've since come to
> believe that was a misconception. Is that so?

I believe that a sysroot is necessary for making a relocatable
toolchain, but it doesn't matter if it is /, /$TARGET, or something
else. If you build with --with-sysroot, gcc will look for headers
relative to itself, and will not look in /.

What doesn't seem to be possible is a "half-relocatable" toolchain,
where it searches both in /include relative to the relocated sysroot,
and /usr/include on the target system. Perhaps there is some trick or
patch that could make this work.

> I think it would work to pass --with-native-system-header-dir=/include
> for cross and "self-targeting cross" compilers and that this would
> allow dropping the usr symlink for these cases, and to make NATIVE=y
> stop using sysroot at all (and not use this option). (NATIVE=y should
> be more than just $HOST=$TARGET.)

But until this NATIVE=y refactoring, shouldn't we fix native
toolchains to at least be able to find musl headers? It seems your
intention is to search for headers in both /usr/include and
$SYSROOT/include, but currently, neither of those is searched, only
$SYSROOT/usr/include which does not exist.

My patch is intended to just fix this incorrect path, not to change
the meaning of NATIVE=y. Such a change should probably involve
coordination of Zach van Rijn and Laurent Bercot, both of whom
distribute pre-built native toolchains (currently containing a usr ->
. symlink). Consumers of those toolchains probably expect a
self-contained, relocatable toolchain, since that's what they are
currently getting.

  reply	other threads:[~2020-05-13 19:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07  6:49 [musl-cross-make] [PATCH] " Michael Forney
2020-03-23  4:34 ` [musl] [musl-cross-make] [PATCH v2] " Michael Forney
2020-05-09  0:27   ` [musl] " Michael Forney
2020-05-10 16:35     ` Rich Felker
2020-05-10 20:35       ` Michael Forney
2020-05-10 21:52         ` Rich Felker
2020-05-13  8:18           ` Michael Forney
2020-05-13 14:37             ` Rich Felker
2020-05-13 18:48               ` Michael Forney
2020-05-13 18:55                 ` Rich Felker
2020-05-13 19:34                   ` Michael Forney [this message]
2020-05-13 20:04                     ` Laurent Bercot
2020-05-13 21:51                       ` Rich Felker
2020-05-14  8:40                         ` Laurent Bercot
2020-08-19 21:00       ` Michael Forney

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=CAGw6cBuGHa3KUhHCnKx5U5Wqh1awPKFwDhRiM5W8e7rL+1Cqhw@mail.gmail.com \
    --to=mforney@mforney.org \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).