git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Peter Seiderer <ps.report@gmx.net>,  git@vger.kernel.org
Subject: Re: Meson build leaks host 'sh' path to target build when cross-compiled
Date: Mon, 10 Feb 2025 08:18:44 -0800	[thread overview]
Message-ID: <xmqqlduddb8b.fsf@gitster.g> (raw)
In-Reply-To: <Z6mtnmvKMsIOEVz5@pks.im> (Patrick Steinhardt's message of "Mon, 10 Feb 2025 08:41:18 +0100")

Patrick Steinhardt <ps@pks.im> writes:

> On Sun, Feb 09, 2025 at 01:30:27PM +0100, Peter Seiderer wrote:
> [snip]
>>   The meson build tries to execute the non-existent '/usr/bin/sh' (instead of
>>   '/bin/sh' as the autoconf build), 'which sh' on the host returns
>>   '/usr/bin/sh'...
>> 
>>   From meson.build
>> 
>>    [...]
>>    186 shell = find_program('sh', dirs: program_path)
>>    [...]
>>    685   '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
>> 
>>   Do not use the result of 'find_program('sh',...)' for '-DSHELL_PATH='
>>   (at least not for cross-compile), use fix '/bin/sh' instead or make it
>>   configurable via a meson option?
>
> Hm, very true. We're mixing up concerns here by treating the build
> environment and the target environment the same.
> ...
> The patch should look somewhat like the attached patch, but it conflicts
> with my in-flight patch series at [1]. I'll wait for that series to be
> merged to `next` before sending out the fix.

Interesting.  When we did our make-based build, we never seriously
considered cross building into a platform where the path to the
basic tools differed between the host and target hosts.  At least in
our build procedure in olden times, I think we used to assume that
what we just built can be run inside the build procedure on the host
platform even outside the tests, which would make cross building
impossible.

Now, since we are "fixing" this aspect of the build for meson-based
build, should we also make the same fix for make-based build as well?

I'd have to say that I prefer to see it done out of pure principle
(i.e. we earlier declared that meson is not yet replacing make, so
adding new shinies only to meson-world is like making the make-world
bitrot as if we do not care).

But on the other hand, nobody complained that they cannot cross
build with make-based build seriously enough to cause us consider
doing something about it for the past 20 years, so the pragmast in
me tells me that it is not worth it doing it in make-based build.

> Thanks for your report!

Yup, thanks.

  parent reply	other threads:[~2025-02-10 16:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-09 12:30 Meson build leaks host 'sh' path to target build when cross-compiled Peter Seiderer
2025-02-10  7:41 ` Patrick Steinhardt
2025-02-10 11:26   ` Peter Seiderer
2025-02-18 11:47     ` Patrick Steinhardt
2025-02-18 14:41       ` Eli Schwartz
2025-02-10 16:18   ` Junio C Hamano [this message]
2025-02-10 16:43     ` Peter Seiderer
2025-02-10 19:54       ` Junio C Hamano
2025-02-11  8:55         ` Peter Seiderer

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=xmqqlduddb8b.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ps.report@gmx.net \
    --cc=ps@pks.im \
    /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 NNTP newsgroup(s).