Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/libxml-parser-perl: fix build when host matches target gcc
@ 2022-12-10 13:17 Norbert Lange
  2022-12-10 16:18 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Norbert Lange @ 2022-12-10 13:17 UTC (permalink / raw)
  To: buildroot; +Cc: Norbert Lange, Thomas Petazzoni

The host configure and build step looks for same compiler name
(eg. x86_64-linux-gnu-gcc), and the build potentially breaks
if the target compiler is named identically.

revert PATH env variable to not include the target binaries.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/libxml-parser-perl/libxml-parser-perl.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/libxml-parser-perl/libxml-parser-perl.mk b/package/libxml-parser-perl/libxml-parser-perl.mk
index 37cef2e418..4af4485429 100644
--- a/package/libxml-parser-perl/libxml-parser-perl.mk
+++ b/package/libxml-parser-perl/libxml-parser-perl.mk
@@ -14,6 +14,7 @@ LIBXML_PARSER_PERL_RUN_PERL = `which perl`
 
 HOST_LIBXML_PARSER_PERL_CONFIGURE_OPTS = \
 	$(HOST_CONFIGURE_OPTS) \
+	PATH="$(PATH)" \
 	LD="$(HOSTCC)"
 
 define HOST_LIBXML_PARSER_PERL_CONFIGURE_CMDS
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] package/libxml-parser-perl: fix build when host matches target gcc
  2022-12-10 13:17 [Buildroot] [PATCH] package/libxml-parser-perl: fix build when host matches target gcc Norbert Lange
@ 2022-12-10 16:18 ` Yann E. MORIN
  2022-12-10 16:55   ` Norbert Lange
  0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2022-12-10 16:18 UTC (permalink / raw)
  To: Norbert Lange; +Cc: Thomas Petazzoni, buildroot

Norbert, All,

On 2022-12-10 14:17 +0100, Norbert Lange spake thusly:
> The host configure and build step looks for same compiler name
> (eg. x86_64-linux-gnu-gcc), and the build potentially breaks
> if the target compiler is named identically.
> 
> revert PATH env variable to not include the target binaries.

We pass $(HOST_CONFIGURE_OPTS) in the environment, which contains a
definition for: CC=$(HOSTCC)

And HOSTCC is defined as:

    ifndef HOSTCC
    HOSTCC := gcc
    HOSTCC := $(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
    endif

In my case, however, I can indeed see that it uses it (single line
wrapped for readability):

    /usr/bin/gcc -c  -I/home/ymorin/dev/buildroot/O/master/host/include
    -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe
    -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g
    -DVERSION=\"2.46\" -DXS_VERSION=\"2.46\" -fPIC
    "-I/usr/lib/x86_64-linux-gnu/perl/5.30/CORE"   Expat.c

So, I looked at the generated Makefile, and I can see;

    # These definitions are from config.sh (via /usr/lib/x86_64-linux-gnu/perl/5.30/Config.pm).
    # They may have been overridden via Makefile.PL or on the command line.

So, we are passing CC et all in the environment, so they do not override
the ones my system perl was built with.

We are also even forcing LD, but it is not accounted for either... I
guess that _may_ work when we are building our own host-perl, but not
when we are using the system perl...

So, I think the best fix would be to change how we pass CC et al,
either by passing HOST_LIBXML_PARSER_PERL_CONFIGURE_OPTS as options
instead of in the environment, or by carefully cherry-picking CC, LD and
maybe a few others, and force them to be passed as options.

Regards,
Yann E. MORIN.

> Signed-off-by: Norbert Lange <nolange79@gmail.com>
> ---
>  package/libxml-parser-perl/libxml-parser-perl.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/libxml-parser-perl/libxml-parser-perl.mk b/package/libxml-parser-perl/libxml-parser-perl.mk
> index 37cef2e418..4af4485429 100644
> --- a/package/libxml-parser-perl/libxml-parser-perl.mk
> +++ b/package/libxml-parser-perl/libxml-parser-perl.mk
> @@ -14,6 +14,7 @@ LIBXML_PARSER_PERL_RUN_PERL = `which perl`
>  
>  HOST_LIBXML_PARSER_PERL_CONFIGURE_OPTS = \
>  	$(HOST_CONFIGURE_OPTS) \
> +	PATH="$(PATH)" \
>  	LD="$(HOSTCC)"
>  
>  define HOST_LIBXML_PARSER_PERL_CONFIGURE_CMDS
> -- 
> 2.35.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] package/libxml-parser-perl: fix build when host matches target gcc
  2022-12-10 16:18 ` Yann E. MORIN
@ 2022-12-10 16:55   ` Norbert Lange
  0 siblings, 0 replies; 3+ messages in thread
From: Norbert Lange @ 2022-12-10 16:55 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Thomas Petazzoni, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 4374 bytes --]

On Sat, 10 Dec 2022, 17:18 Yann E. MORIN, <yann.morin.1998@free.fr> wrote:

> Norbert, All,
>
> On 2022-12-10 14:17 +0100, Norbert Lange spake thusly:
> > The host configure and build step looks for same compiler name
> > (eg. x86_64-linux-gnu-gcc), and the build potentially breaks
> > if the target compiler is named identically.
> >
> > revert PATH env variable to not include the target binaries.
>
> We pass $(HOST_CONFIGURE_OPTS) in the environment, which contains a
> definition for: CC=$(HOSTCC)
>
> And HOSTCC is defined as:
>
>     ifndef HOSTCC
>     HOSTCC := gcc
>     HOSTCC := $(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
>     endif
>
> In my case, however, I can indeed see that it uses it (single line
> wrapped for readability):
>
>     /usr/bin/gcc -c  -I/home/ymorin/dev/buildroot/O/master/host/include
>     -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe
>     -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g
>     -DVERSION=\"2.46\" -DXS_VERSION=\"2.46\" -fPIC
>     "-I/usr/lib/x86_64-linux-gnu/perl/5.30/CORE"   Expat.c
>
> So, I looked at the generated Makefile, and I can see;
>
>     # These definitions are from config.sh (via
> /usr/lib/x86_64-linux-gnu/perl/5.30/Config.pm).
>     # They may have been overridden via Makefile.PL or on the command line.
>
> So, we are passing CC et all in the environment, so they do not override
> the ones my system perl was built with.
>

I actually dont see where the compiler name comes from in my case

We are also even forcing LD, but it is not accounted for either... I
> guess that _may_ work when we are building our own host-perl, but not
> when we are using the system perl...
>
> So, I think the best fix would be to change how we pass CC et al,
> either by passing HOST_LIBXML_PARSER_PERL_CONFIGURE_OPTS as options
> instead of in the environment, or by carefully cherry-picking CC, LD and
> maybe a few others, and force them to be passed as options.
>

I actually forgot about it, thinking it has been accepted, but you
find an earlier patch from myself at [1] (ML archive seems dead ATM?).

I think having the "wrong" compiler in path generally is asking for trouble,
this package doesnt need any BR provided host-tools so its fine without.
I don't know how to fix this in a clean manner for the general case
(some host pkgs might just build with target compiler without anyone
noticing).

perhaps install wrappers for the target toolchain in eg.
$(HOST_DIR)/fake-bin/x86_64-linux-gnu-gcc

wrappers would print a warning (possibly break the build later, if the
problem is
better understood), then forward the arguments to
/usr/bin/x86_64-linux-gnu-gcc
(same thing for every target toolchain binary).

only on host configure/build/install steps the '$(HOST_DIR)/fake-bin'
entry would be added in front of PATH.

regards,
Norbert


> Regards,
> Yann E. MORIN.
>
> > Signed-off-by: Norbert Lange <nolange79@gmail.com>
> > ---
> >  package/libxml-parser-perl/libxml-parser-perl.mk | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/package/libxml-parser-perl/libxml-parser-perl.mk
> b/package/libxml-parser-perl/libxml-parser-perl.mk
> > index 37cef2e418..4af4485429 100644
> > --- a/package/libxml-parser-perl/libxml-parser-perl.mk
> > +++ b/package/libxml-parser-perl/libxml-parser-perl.mk
> > @@ -14,6 +14,7 @@ LIBXML_PARSER_PERL_RUN_PERL = `which perl`
> >
> >  HOST_LIBXML_PARSER_PERL_CONFIGURE_OPTS = \
> >       $(HOST_CONFIGURE_OPTS) \
> > +     PATH="$(PATH)" \
> >       LD="$(HOSTCC)"
> >
> >  define HOST_LIBXML_PARSER_PERL_CONFIGURE_CMDS
> > --
> > 2.35.1
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>
> --
>
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
> conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
>      |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is
> no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
>  conspiracy.  |
>
> '------------------------------^-------^------------------^--------------------'
>

[1] - https://lists.buildroot.org/pipermail/buildroot/2020-June/284219.html

[-- Attachment #1.2: Type: text/html, Size: 6807 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-10 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-10 13:17 [Buildroot] [PATCH] package/libxml-parser-perl: fix build when host matches target gcc Norbert Lange
2022-12-10 16:18 ` Yann E. MORIN
2022-12-10 16:55   ` Norbert Lange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox