git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Meson build leaks host 'sh' path to target build when cross-compiled

From
PSPeter Seiderer <ps.report@gmx.net>
Date
Feb 11, 2025, 08:55 UTC
Message-ID
<20250211095544.66226abc@gmx.net>
In-Reply-To
<xmqqpljpa83y.fsf@gitster.g>
Hello Junio,
On Mon, 10 Feb 2025 11:54:25 -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Peter Seiderer <ps.report@gmx.net> writes:
>
> > Maybe all doing (autoconf) cross builds where happy with the defaults
> > from the Makefile (SHELL_PATH = /bin/sh, PERL_PATH = /usr/bin/perl)
> > on host and target (as the buildroot autoconf package since 2013) and
> > only users doing native builds fiddled around with non-default values?
>
> I somehow doubt it.
>
> The problem I see is that there is no distinction between "this is
> the path for the shell on the target system" vs "this is the shell
> we run on the host while building the package" in the Makefile.  Use
> of autoconf would not magically change it; the Makefile that
> includes the config.mak.autogen needs to be aware of the
> distinction.

Found no problem/special-handling in buildroot ([1]) or yocto ([2]) for SHELL_PATH, but you are right regarding the PERL_PATH in yocto using

  38 EXTRA_OECONF = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl \
and
  49 EXTRA_OEMAKE += "'PERL_PATH=/usr/bin/env perl'"
and a fixup for the resulting files
  76 perl_native_fixup () {
  77 	sed -i -e 's#${STAGING_BINDIR_NATIVE}/perl-native/#${bindir}/#' \
  78 	       -e 's#${libdir}/perl-native/#${libdir}/#' \
  79 	    ${@d.getVar("PERLTOOLS").replace(' /',d.getVar('D') + '/')}

Yes, doing a distinct handling for host/target path for sh/perl for meson/autoconf is for sure the right thing ;-)

Regards, Peter

[1] https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/git/git.mk [2] https://git.yoctoproject.org/poky/tree/meta/recipes-devtools/git/git_2.48.1.bb

Previous: Junio C Hamano
Message 9 of 9 in “Meson build leaks host 'sh' path to target build when cross-compiled”
  1. Peter SeidererFeb 9, 2025
  2. Patrick SteinhardtFeb 10, 2025
  3. Peter SeidererFeb 10, 2025
  4. Patrick SteinhardtFeb 18, 2025
  5. Eli SchwartzFeb 18, 2025
  6. Junio C HamanoFeb 10, 2025
  7. Peter SeidererFeb 10, 2025
  8. Junio C HamanoFeb 10, 2025
  9. Peter SeidererFeb 11, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.